你可以使用array_replace和array_filter
array_replace
array_filter
$mergedArray = array_replace($b, array_filter($a));
结果将是:
array(3) { ["key1"]=> string(19) "key1 from prioritar" ["key2"]=> string(24) "key2 from LESS prioritar" ["my_problem"]=> string(18) "I REACHED MY GOAL!" }