3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function profiler($a, $b, $c) { $profilerOn = true; switch (true) { case $a; case $b; case $c; // turn off profiler $profilerOn = false; } return $profilerOn; } // last true echo "Off:\n=======\n"; var_dump(profiler(true, true, true)); var_dump(profiler(false, false, true)); var_dump(profiler(true, false, true)); var_dump(profiler(false, true, true)); // last not true echo "\n\nOn:\n======\n"; var_dump(profiler(false, false, false)); var_dump(profiler(true, false, false)); var_dump(profiler(false, true, false)); var_dump(profiler(true, true, false));
Output for 4.3.0 - 7.2.0
Off: ======= bool(false) bool(false) bool(false) bool(false) On: ====== bool(true) bool(false) bool(false) bool(false)