Saturday, September 14, 2013

PHP Merge 1 Dimensional Array with 2 Dimensional Array on keys and keep all keys unique and values from 2nd Array

PHP Merge 1 Dimensional Array with 2 Dimensional Array on keys and keep
all keys unique and values from 2nd Array

1st Array: One Dimension, 2nd Array: Two Dimension
I want to merge the two arrays by key, keep the keys and the values of the
2nd Array
1st Array (
[30] => 30
[28] => 28
[27] => 27
[16] => 16
)
2nd Array (
[27] => Array (
[person_id] => 27
[person_name] => Jazz Club
[person_job] => 10
[drink_price] => 5
)
)
Expected result Array (
[30] => 30
[28] => 28
[27] => [27] => Array
(
[person_id] => 27
[person_name] => Jazz Club
[person_job] => 10
[drink_price] => 5
)
[16] => 16
)

No comments:

Post a Comment