I have an associative array that holds the settings of my object. I also have a function that allows the user to override these setting by passing an associative array of replacement settings. I can use array_replace() however I don't want any values with unknown associative array keys to be added to the settings.
e.g.
$settings = array(
'colour' => 'red',
'size' => 'big'
);
$settings = array_replace( $settings, array(
'size' => 'small',
'weight' => 'heavy'
) );
I want settings to produce:
Array
(
[colour] => red
[size] => small
)
Instead I get this:
Array
(
[colour] => red
[size] => small
[weight] => heavy
)