3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $xml = '<items><item/><item/><item/></items>'; $dom = new DOMDocument(); $dom->loadXml($xm); var_dump(iterator_to_array($dom->documentElement->childNodes));
Output for 7.0.0 - 7.1.0
Notice: Undefined variable: xm in /in/4MpUN on line 6 Warning: DOMDocument::loadXML(): Empty string supplied as input in /in/4MpUN on line 6 Notice: Trying to get property of non-object in /in/4MpUN on line 9 Fatal error: Uncaught TypeError: Argument 1 passed to iterator_to_array() must implement interface Traversable, null given in /in/4MpUN:9 Stack trace: #0 /in/4MpUN(9): iterator_to_array(NULL) #1 {main} thrown in /in/4MpUN on line 9
Process exited with code 255.
Output for hhvm-3.10.0 - 3.12.0
Notice: Undefined variable: xm in /in/4MpUN on line 6 Warning: Empty string supplied as input Notice: Cannot access property on non-object in /in/4MpUN on line 9 Catchable fatal error: Argument must implement interface Traversable in /in/4MpUN on line 9
Process exited with code 255.
Output for 5.2.0 - 5.6.28
Notice: Undefined variable: xm in /in/4MpUN on line 6 Warning: DOMDocument::loadXML(): Empty string supplied as input in /in/4MpUN on line 6 Notice: Trying to get property of non-object in /in/4MpUN on line 9 Catchable fatal error: Argument 1 passed to iterator_to_array() must implement interface Traversable, null given in /in/4MpUN on line 9
Process exited with code 255.
Output for 5.1.0 - 5.1.6
Notice: Undefined variable: xm in /in/4MpUN on line 6 Warning: DOMDocument::loadXML(): Empty string supplied as input in /in/4MpUN on line 6 Notice: Trying to get property of non-object in /in/4MpUN on line 9 Warning: iterator_to_array() expects parameter 1 to be Traversable, null given in /in/4MpUN on line 9 bool(false)
Output for 5.0.4 - 5.0.5
Notice: Undefined variable: xm in /in/4MpUN on line 6 Warning: DOMDocument::loadXML(): Empty string supplied as input in /in/4MpUN on line 6 Fatal error: Call to undefined function iterator_to_array() in /in/4MpUN on line 9
Process exited with code 255.
Output for 5.0.0 - 5.0.3
Notice: Undefined variable: xm in /in/4MpUN on line 6 Warning: DOMDocument::loadXML(): Empty string supplied as input in /in/4MpUN on line 6 Fatal error: Call to undefined function iterator_to_array() in /in/4MpUN on line 9
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: domdocument in /in/4MpUN on line 5
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: domdocument in /in/4MpUN on line 5