3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $xml = <<<XML <?xml version="1.0"?> <a> <b> <c> <value>Some Value</value> </c> </b> </a> XML; $a = new SimpleXMLElement($xml); #$nodes = $a->xpath('/a/b/c/value'); #$node = $nodes[0]; $node = $a->b->c->value; if ($node) { echo "Element is not empty"; } else { echo "Element is empty"; }
Output for 5.0.0 - 7.1.0
Element is not empty
Output for 4.3.2 - 4.4.1, 4.4.3 - 4.4.9
<br /> <b>Fatal error</b>: Cannot instantiate non-existent class: simplexmlelement in <b>/in/fFW96</b> on line <b>13</b><br />
Process exited with code 255.
Output for 4.4.2
<br /> <b>Fatal error</b>: Cannot instantiate non-existent class: simplexmlelement in <b>/in/fFW96</b> on line <b>14</b><br />
Process exited with code 255.
Output for 4.3.0 - 4.3.1
<br /> <b>Fatal error</b>: Cannot instantiate non-existent class: simplexmlelement in <b>/in/fFW96</b> on line <b>13</b><br />