3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $a = array( 'id' => 1, 'name' => 'Jacopo', 'male' => true, 'hobbies' => array( 'Programming', 'TV Shows', 'Skiing' ) ); $xml = new SimpleXMLElement('<root/>'); array_walk_recursive($a, array ($xml, 'addChild')); print $xml->asXML();
Output for 5.1.3 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
<?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 5.0.0 - 5.1.2
Warning: array_walk_recursive(): Unable to call SimpleXMLElement::addChild() - function does not exist in /in/mnGUN on line 14 <?xml version="1.0"?> <root/>
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: simplexmlelement in /in/mnGUN on line 13
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: simplexmlelement in /in/mnGUN on line 13