3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $a = array( 'id' => 1, 'name' => 'Jacopo', 'male' => true, 'birthday' => new DateTime('1988-07-26'), 'hobbies' => array( 'Programming', 'TV Shows', 'Skiing' ) ); $xml = new SimpleXMLElement('<root/>'); array_walk_recursive($a, array ($xml, 'addChild')); print $xml->asXML();
Output for 5.2.0 - 5.6.28, 7.0.0 - 7.1.0
Warning: SimpleXMLElement::addChild() expects parameter 1 to be string, object given in /in/KgWjt on line 15 <?xml version="1.0"?> <root><1>id</1><Jacopo>name</Jacopo><1>male</1><Programming>0</Programming><TV Shows>1</TV Shows><Skiing>2</Skiing></root>
Output for hhvm-3.12.0
Warning: addChild() expects parameter 1 to be string, object given in /in/KgWjt on line 15 <?xml version="1.0"?> <root><1>id</1><Jacopo>name</Jacopo><1>male</1><Programming>0</Programming><TV Shows>1</TV Shows><Skiing>2</Skiing></root>
Output for hhvm-3.10.0
Catchable fatal error: Object of class DateTime could not be converted to string in /in/KgWjt on line 15
Process exited with code 255.
Output for 5.0.0 - 5.1.6
Fatal error: Class 'DateTime' not found in /in/KgWjt on line 6
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: datetime in /in/KgWjt on line 6
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: datetime in /in/KgWjt on line 6