Skip to content

Instantly share code, notes, and snippets.

@woodworker
Created February 17, 2011 14:44
Show Gist options
  • Save woodworker/831845 to your computer and use it in GitHub Desktop.
Save woodworker/831845 to your computer and use it in GitHub Desktop.
Sometimes i really hate PHP :D
<?php
$a = 0;
switch ($a) {
case 'test':
$b = 'TEST';
break;
default:
$b = 'DEFAULT';
}
// will echo "Test" because $a is an int, so every case will be compared as int and intval('test')===0
// MINDFUCK - arg
// PS: would be the name of the case 1test then it would be converted to 1 and so on
echo $b;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment