<?php
'a' => NULL,
'b' => 1,
'c' => 1
);
'a' => 1,
'b' => NULL,
'c' => 1
);
function arrayMergeIgnoringNull($arr1, $arr2) {
forEach ($arr2 as $key => $value) {
if (($value !== NULL) || !isSet($arr1[$key])) { $new2[$key] = $value;
}
}
}
$c = arrayMergeIgnoringNull($a, $b);
?>
PD9waHAKJGEgPSBhcnJheSgKICAgICdhJyA9PiBOVUxMLAogICAgJ2InID0+IDEsCiAgICAnYycgPT4gMQopOwoKJGIgPSBhcnJheSgKICAgICdhJyA9PiAxLAogICAgJ2InID0+IE5VTEwsCiAgICAnYycgPT4gMSAgICAKKTsKCmZ1bmN0aW9uIGFycmF5TWVyZ2VJZ25vcmluZ051bGwoJGFycjEsICRhcnIyKSB7CiAgICAkbmV3MiA9IGFycmF5KCk7CiAgICBmb3JFYWNoICgkYXJyMiBhcyAka2V5ID0+ICR2YWx1ZSkgewogICAgICAgIGlmICgoJHZhbHVlICE9PSBOVUxMKSB8fCAhaXNTZXQoJGFycjFbJGtleV0pKSB7CiAgICAgICAgICAgICRuZXcyWyRrZXldID0gJHZhbHVlOwogICAgICAgIH0gCiAgICB9CiAgICAKICAgIHJldHVybiBhcnJheV9tZXJnZSgkYXJyMSwgJG5ldzIpOwp9CgokYyA9IGFycmF5TWVyZ2VJZ25vcmluZ051bGwoJGEsICRiKTsKcHJpbnRfcigkYyk7Cj8+Cg==