3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $a = ['read' => [1,2]]; $b = ['read' => [2,3]]; $c = array_replace($b, $a); foreach ($c as $key => $value) { if (is_array($value) && isset($b[$key])) { echo 1; $c[$key] = array_unique(array_replace($value, $b[$key])); } elseif (empty($value) && isset($b[$key])) { $c[$key] = $b[$key]; } } var_dump($c);
based on kQPtV
Output for 5.6.0 - 5.6.30, hhvm-3.18.5 - 3.22.0, 7.1.0 - 7.3.0beta1
1array(1) { ["read"]=> array(2) { [0]=> int(2) [1]=> int(3) } }