1 2 3 4 5 6 7 8 9 10 11
<? function foo ($x) { switch ($x) { case "hello": return "hello "; case "": return "empty "; case false: return "false "; case true: return "true "; default: return "default "; } } echo foo(true), foo(false), foo(1), foo(2);
1
hello empty true true