3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $xml = new SimpleXmlElement('<xml><body></body></xml>'); var_dump($xml->body->div[0]->p); var_dump($xml->foo->div->p); var_dump($xml->body[0]->p); var_dump($xml->body->count()); var_dump($xml->body->div->count());
based on l9AfL
Output for 7.2.0
Notice: Trying to get property 'p' of non-object in /in/aN1L6 on line 5 NULL Notice: Trying to get property 'p' of non-object in /in/aN1L6 on line 6 NULL object(SimpleXMLElement)#4 (0) { } int(1) int(0)
Output for 5.3.18 - 7.1.10
Notice: Trying to get property of non-object in /in/aN1L6 on line 5 NULL Notice: Trying to get property of non-object in /in/aN1L6 on line 6 NULL object(SimpleXMLElement)#4 (0) { } int(1) int(0)