3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $a = array('xml' => array( 'attributes' => array( 'version' => '1.0', 'encoding' => 'utf-8', ), )); $a['attributes'] = array_merge($a['attributes'], array('test' => 'my_test_123')); var_dump($a);
Output for 5.3.0 - 5.6.28, 7.0.0 - 7.1.0
Notice: Undefined index: attributes in /in/ZMQpu on line 8 Warning: array_merge(): Argument #1 is not an array in /in/ZMQpu on line 8 array(2) { ["xml"]=> array(1) { ["attributes"]=> array(2) { ["version"]=> string(3) "1.0" ["encoding"]=> string(5) "utf-8" } } ["attributes"]=> NULL }
Output for hhvm-3.10.0 - 3.12.0
Notice: Undefined index: attributes in /in/ZMQpu on line 8 Warning: array_merge() expects parameter 1 to be array, null given in /in/ZMQpu on line 8 array(2) { ["xml"]=> array(1) { ["attributes"]=> array(2) { ["version"]=> string(3) "1.0" ["encoding"]=> string(5) "utf-8" } } ["attributes"]=> NULL }
Output for 5.0.0 - 5.2.17
Notice: Undefined index: attributes in /in/ZMQpu on line 8 Warning: array_merge(): Argument #1 is not an array in /in/ZMQpu on line 8 array(2) { ["xml"]=> array(1) { ["attributes"]=> array(2) { ["version"]=> string(3) "1.0" ["encoding"]=> string(5) "utf-8" } } ["attributes"]=> NULL }
Output for 4.3.0 - 4.4.9
Notice: Undefined index: attributes in /in/ZMQpu on line 8 array(2) { ["xml"]=> array(1) { ["attributes"]=> array(2) { ["version"]=> string(3) "1.0" ["encoding"]=> string(5) "utf-8" } } ["attributes"]=> array(1) { ["test"]=> string(11) "my_test_123" } }