3v4l.org

run code in 300+ PHP versions simultaneously
<?php $xml =<<<EOF <?xml version='1.0'?> <root/> EOF; $root = simplexml_load_string($xml); var_dump($root->foo); var_dump($root->foo->children()); var_dump($root->foo->bar); var_dump($root->foo->bar->children());
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.34, 8.2.0 - 8.2.30, 8.3.0 - 8.3.30, 8.4.1 - 8.4.18, 8.5.0 - 8.5.3
object(SimpleXMLElement)#2 (0) { } NULL NULL Fatal error: Uncaught Error: Call to a member function children() on null in /in/nODug:12 Stack trace: #0 {main} thrown in /in/nODug on line 12
Process exited with code 255.
Output for 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
object(SimpleXMLElement)#2 (0) { } Warning: var_dump(): Node no longer exists in /in/nODug on line 10 object(SimpleXMLElement)#3 (0) { } NULL Fatal error: Uncaught Error: Call to a member function children() on null in /in/nODug:12 Stack trace: #0 {main} thrown in /in/nODug on line 12
Process exited with code 255.

preferences:
100.37 ms | 1532 KiB | 4 Q