3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function check($value) { if ($value != "") { echo 'is not an empty string'; } else if ($value == '') { echo 'is an empty string'; } else { echo 'SOMETHING ELSE'; } } foreach(array( '', 0, false, true, null, -1, array(), 1, '0', '1' ) as $value) { echo trim(var_export($value, true)), ': ', check($value), "\n"; }
Output for 4.3.0 - 5.6.28, hhvm-3.12.0, 7.0.0 - 7.1.0
'': is an empty string 0: is an empty string false: is an empty string true: is not an empty string NULL: is an empty string -1: is not an empty string array ( ): is not an empty string 1: is not an empty string '0': is not an empty string '1': is not an empty string
Output for hhvm-3.10.0

Process exited with code 153.