I have this array :
Array (amounts)
(
[0] => Array
(
[0] => 95
[1] => 2
)
[1] => Array
(
[0] => 96
[1] => 5
)
)
And this
Array (invoices)
(
[1] =>
[2] => 490
[3] =>
[4] =>
[5] => 1400
)
This is what I am trying to get :
Array
(
[1] =>
[95] => 490 // Id found in Amounts array so replaced id by Key '0'
[3] =>
[4] =>
[96] => 1400 // Id found in Amounts array so replaced id by Key '0'
)
I have tried to deal with the answser found here but without success.
$newamounts = array_combine(array_map(function($key) use ($invoices) {
return $invoices[$key]; // translate key to name
}, array_keys($invoices)), $amounts);
Any help greatly appreciated. Thx