Skip to content

Instantly share code, notes, and snippets.

@cmbuckley
Created November 3, 2012 18:08
Show Gist options
  • Save cmbuckley/4008155 to your computer and use it in GitHub Desktop.
Save cmbuckley/4008155 to your computer and use it in GitHub Desktop.
Duck typing in a switch statement
<?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