10-24-2009, 03:15 AM
|
#1 (permalink)
|
|
is cute and cuddly
Join Date: Mar 2008
Location: Vegas, Baby
Posts: 963
Thanks: 31
|
Array merge on similar key => value
I have three arrays I'm working with based on queries pulled from a database. All of them have one key => value pair in common, and I'm looking for the most elegant way to merge these arrays.
array_merge() of course won't work, and I'm curious if there's a better solution than iterating through and merging it 'by hand' so to speak within a loop.
For example, the arrays all follow this paradigm;
Code:
Array
(
[0] => Array
(
[timestamp] => 2009-10-23
[key_one] => value_one
)
....
Array
(
[0] => Array
(
[timestamp] => 2009-10-23
[another_key] => another_value
)
The desired result, is of course;
Code:
Array
(
[0] => Array
(
[timestamp] => 2009-10-23
[key_one] => value_one
[another_key] => another_value
)
|
|
|
|