3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $foo = 'bar'; print "regular string ... "; var_dump(empty($foo)); #Should be false $xml = simplexml_load_string("<xml><something>somevalue</something></xml>"); $xml2 = simplexml_load_string("<xml>\n<something>somevalue</something>\n</xml>"); foreach($xml as $key => $value) { print "$key = $value ... "; var_dump(empty($value)); # Should be false var_dump($value == false); # Should be false } foreach($xml2 as $key => $value) { print "$key = $value ... "; var_dump(empty($value)); # Should be false, but isn't var_dump($value == false); # Should be false } ?>
Output for 5.0.0 - 5.3.29, 5.5.27 - 5.5.35, 5.6.11 - 5.6.28, hhvm-3.12.0, 7.0.0 - 7.1.0
regular string ... bool(false) something = somevalue ... bool(false) bool(false) something = somevalue ... bool(false) bool(false)
Output for hhvm-3.10.0

Process exited with code 153.
Output for 5.4.0 - 5.5.26, 5.6.8 - 5.6.10
regular string ... bool(false) something = somevalue ... bool(false) bool(false) something = somevalue ... bool(true) bool(false)
Output for 4.4.5 - 4.4.9
regular string ... bool(false) Fatal error: Call to undefined function: simplexml_load_string() in /in/rr1ir on line 6
Process exited with code 255.
Output for 4.3.2 - 4.4.4
regular string ... bool(false) Fatal error: Call to undefined function: simplexml_load_string() in /in/rr1ir on line 6
Process exited with code 255.
Output for 4.3.0 - 4.3.1
regular string ... bool(false) Fatal error: Call to undefined function: simplexml_load_string() in /in/rr1ir on line 6