<?
switch(0) {
case "text": var_dump("casejump"); break;
default: var_dump("default");
}
Output is:
casejump
This is so because 0 == "string" is always true because it converts the string to a number, which results in 0.
Moments of joy with PHP - (and other languages (but mostly PHP :D))
No comments:
Post a Comment