3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $xml = new SimpleXMLElement('<tag></tag>'); if($xml) { echo 'An empty SimpleXMLElement is truthy'; } else { echo 'An empty SimpleXMLElement is falsey'; } echo "\n"; $obj = new stdClass(); if($obj) { echo 'An empty stdClass is truthy'; } else { echo 'An empty stdClass is falsey'; }
based on Kb1G7
Output for 5.1.0 - 7.1.0
An empty SimpleXMLElement is falsey An empty stdClass is truthy
Output for 5.0.0 - 5.0.5
An empty SimpleXMLElement is truthy An empty stdClass is truthy
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: simplexmlelement in /in/odeO2 on line 2
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: simplexmlelement in /in/odeO2 on line 2