3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $one = [1]; $two = [42]; $arr1 = ['k' => &$one]; $arr2 = ['k' => &$two]; var_dump(current($one), current($two)); print_r(array_replace_recursive($arr1, $arr2)); var_dump(current($one), current($two));
based on AjvAd
Output for 5.4.11 - 5.6.28, 7.0.20 - 7.2.0
int(1) int(42) Array ( [k] => Array ( [0] => 42 ) ) int(1) int(42)
Output for 7.0.0 - 7.0.6
int(1) int(42) Array ( [k] => Array ( [0] => 42 ) ) int(42) int(42)
Output for 5.3.21 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/hKb0f on line 3
Process exited with code 255.