3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function append(array $init, array $add, $key = null) { $_init = $init; if (is_null($key)) $_init[] = $add; else $_init[$key] = $add; return $_init; } $a = [ 'phone' => [ 'code' => '+38', ], ]; $b = [ 'prefix' => '095', 'number' => '7700418', ], ]; var_dump(append($a, $b, 'phone'));
Output for 5.4.0 - 5.4.14
Parse error: syntax error, unexpected ',' in /in/rSr6D on line 20
Process exited with code 255.
Output for 5.3.0 - 5.3.24
Parse error: syntax error, unexpected '[' in /in/rSr6D on line 12
Process exited with code 255.