3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $xml = '<items><item/><item/><item/></items>'; $dom = new DOMDocument(); $dom->loadXml($xml); $array = iterator_to_array($dom->documentElement->childNodes); var_dump(count($array), array_keys($array));
Output for 5.3.7 - 7.1.0
int(3) array(3) { [0]=> int(0) [1]=> int(1) [2]=> int(2) }
Output for 5.3.6
int(1) array(1) { [0]=> int(46348704) }
Output for 5.3.5
int(1) array(1) { [0]=> int(47892896) }
Output for 5.3.4
int(1) array(1) { [0]=> int(43121056) }
Output for 5.3.3
int(1) array(1) { [0]=> int(26704288) }
Output for 5.2.0 - 5.3.2
Catchable fatal error: Argument 1 passed to iterator_to_array() must implement interface Traversable, instance of DOMNodeList given in /in/kcAL5 on line 7
Process exited with code 255.
Output for 5.1.0 - 5.1.6
Warning: iterator_to_array() expects parameter 1 to be Traversable, object given in /in/kcAL5 on line 7 Warning: array_keys(): The first argument should be an array in /in/kcAL5 on line 9 int(1) NULL
Output for 5.0.0 - 5.0.5
Fatal error: Call to undefined function iterator_to_array() in /in/kcAL5 on line 7
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: domdocument in /in/kcAL5 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/kcAL5 on line 5