3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function _empty($value) { return $value ? 'non_empty' : 'empty'; } function _empty_fix($value) { $value = is_numeric($value) ? floatval($value) : $value; return $value ? 'non_empty' : 'empty'; } echo "normal :\n"; echo "\n0 : ", _empty(0); echo "\n0.0 : ", _empty(0.0); echo "\n'0.0' : ", 1+"5.0"; echo "\n\nfix :\n"; echo "\n0 : ", _empty_fix(0); echo "\n0.0 : ", _empty_fix(0.0); echo "\n'0.0' : ", _empty_fix('0.0');
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
normal : 0 : empty 0.0 : empty '0.0' : 6 fix : 0 : empty 0.0 : empty '0.0' : empty