Skip to content

Instantly share code, notes, and snippets.

@ubermichael
Created November 8, 2017 04:40
Show Gist options
  • Save ubermichael/93b6c55dba029b67c52614bafdfce3c0 to your computer and use it in GitHub Desktop.
Save ubermichael/93b6c55dba029b67c52614bafdfce3c0 to your computer and use it in GitHub Desktop.
This should be surprising, but isn't.
<?php
foreach(array(true, false, null, 'a') as $a) {
var_dump($a);
switch($a) {
case true:
print "true";
break;
case null:
print "null";
break;
case false:
print "false";
break;
default:
print "other";
}
print "\n\n";
}
## Output:
// bool(true)
// true
//
// bool(false)
// null
//
// NULL
// null
//
// string(1) "a"
// true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment