Created
November 3, 2012 18:08
-
-
Save cmbuckley/4008155 to your computer and use it in GitHub Desktop.
Duck typing in a switch statement
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$value = 0; | |
switch ($value) { | |
case 'hello': | |
echo 'hello world!'; | |
break; | |
case '1': | |
echo 'one!'; | |
break; | |
case '0': | |
echo 'zero!'; | |
break; | |
default: | |
echo 'default!'; | |
break; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment