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'; } float $var = '0.0'; echo "normal :\n"; echo "\n0 : ", _empty(0); echo "\n0.0 : ", _empty(0.0); echo "\n'0' : ", _empty('0'); echo "\n'0.0' : ", _empty('0.0'); echo "\n\nfix :\n"; echo "\n0 : ", _empty_fix(0); echo "\n0.0 : ", _empty_fix(0.0); echo "\n'0' : ", _empty_fix('0'); echo "\n'0.0' : ", _empty_fix('0.0');
Output for 5.4.0 - 5.5.9
Parse error: syntax error, unexpected '$var' (T_VARIABLE) in /in/vrJ0G on line 11
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected T_VARIABLE in /in/vrJ0G on line 11
Process exited with code 255.