How can I achieve the third array, merging Array1 and Array2? What's the best way to do that in PHP? Many thanks. Array2 has like index (key), the associative value of id in Array1.
Array1
Array
(
[0] => Array
(
[id] => 56
[grade] => 6.7
)
[1] => Array
(
[id] => 214
[grade] => 3.2
)
)
Array2
Array
(
[56] => 2.4
[214] => 5.8
)
Result wanted
Array
(
[0] => Array
(
[id] => 56
[grade] => 2.4
)
[1] => Array
(
[id] => 214
[grade] => 5.8
)
)
Array1, check if theidvalue is a key/set inArray2, and if so replace thegradevalue