Override Array Values with another one
array_merge()
$result = array_merge($first, $second);
As long as you're dealing with string keys, array_merge does exactly what you want. The two arrays are combined, and where the two have the same keys, the values from $second
overwrite the values from $first
.
I think array_merge()
or array_combine()
are the functions you are searching for.