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; } echo " Turn profiler 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)); var_dump(profiler(true, false, false)); var_dump(profiler(false, true, false)); var_dump(profiler(true, true, false)); echo "\n\nLeave profiler on:\n======\n"; var_dump(profiler(false, false, false));
Output for 4.3.0 - 7.3.0rc4
Turn profiler off: ======= bool(false) bool(false) bool(false) bool(false) bool(false) bool(false) bool(false) Leave profiler on: ====== bool(true)