3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $arr1 = array( 't' => array( 'foo' => 'bar', 'bar' => 'foo', 'kip' => array( 'zonder', 'kop', ), ), 'b' => (object) array_combine(range('a', 'z'), range('a', 'z')), ); $arr2 = array( 't' => array( 'foo' => 'aangepast', ), ); $arr3 = array_replace_recursive($arr1, $arr2); echo'<pre>'; print_r($arr1); echo'<hr/>'; print_r($arr2); echo'<hr/>'; print_r($arr3); echo'<hr/>';
based on omREJ
Output for 5.3.0 - 7.2.0
<pre>Array ( [t] => Array ( [foo] => bar [bar] => foo [kip] => Array ( [0] => zonder [1] => kop ) ) [b] => stdClass Object ( [a] => a [b] => b [c] => c [d] => d [e] => e [f] => f [g] => g [h] => h [i] => i [j] => j [k] => k [l] => l [m] => m [n] => n [o] => o [p] => p [q] => q [r] => r [s] => s [t] => t [u] => u [v] => v [w] => w [x] => x [y] => y [z] => z ) ) <hr/>Array ( [t] => Array ( [foo] => aangepast ) ) <hr/>Array ( [t] => Array ( [foo] => aangepast [bar] => foo [kip] => Array ( [0] => zonder [1] => kop ) ) [b] => stdClass Object ( [a] => a [b] => b [c] => c [d] => d [e] => e [f] => f [g] => g [h] => h [i] => i [j] => j [k] => k [l] => l [m] => m [n] => n [o] => o [p] => p [q] => q [r] => r [s] => s [t] => t [u] => u [v] => v [w] => w [x] => x [y] => y [z] => z ) ) <hr/>
Output for 5.0.0 - 5.2.17
Fatal error: Call to undefined function array_replace_recursive() in /in/Xfa0F on line 21
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: array_combine() in /in/Xfa0F on line 12
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Fatal error: Call to undefined function: array_combine() in /in/Xfa0F on line 12
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: array_combine() in /in/Xfa0F on line 12