Working with PHP. I have array 1 with this keys and values:
$array_1 = array(
(more values)
'propub_cost_max' => 5,
'propub_cost_min' => 0.5,
'average_calc_last' => '-1 Months',
'propub_qtd_first_offer' => 4
);
and array 2:
$array_2 = array(
'propub_cost_max' => 20,
'propub_cost_min' => (no value),
'average_calc_last' => (no value),
'propub_qtd_first_offer' => (no value)
);
I want to merge array 2 with array 1 so i did:
$result = array_merge($array_2, $array_1);
But the result is:
$result = array(
(more values)
'propub_cost_max' => 5,
'propub_cost_min' => 0.5,
'average_calc_last' => '-1 Months',
'propub_qtd_first_offer' => 4
);
The propub_cost_max key should assume the value 20, right?
The idea is to maintain some values, and replace where the values are different if there is any value, of course. I thought that array_merge should work, but...
Thank you all.
}instead of a parenthesis.