I am trying to overwrite the elements of one array with values from another – without creating additional elements in the process.
For example:
I can't think of a built in method for that, however, it would be trivial with a loop and array_key_exists.
array_key_exists
foreach( $replace as $k => $v ) { if ( array_key_exists( $k, $base ) ) $base[ $k ] = $v; }