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));
Output for 5.3.7 - 5.6.28, hhvm-3.12.0, 7.0.0 - 7.1.0
int(3)
Output for hhvm-3.10.0

Process exited with code 153.
Output for 5.3.3 - 5.3.6
int(1)
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/QSMeY 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/QSMeY on line 7 int(1)
Output for 5.0.0 - 5.0.5
Fatal error: Call to undefined function iterator_to_array() in /in/QSMeY 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/QSMeY 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/QSMeY on line 5