I have 2 associative arrays: $arr1 & $arr2. I'd like to create $arr3, which would combine 'name' and 'character' if the dates match...if the dates don't match, then just the character:
Here's $arr1:
Array
(
[0] => stdClass Object
(
[date] => 2010/01/01
[name] => Mario Lopez
)
[1] => stdClass Object
(
[date] => 2010/01/02
[name] => Lark Voorhies
)
)
Here's $arr2:
Array
(
[0] => Array
(
[date] => 2010/01/01
[character] => AC Slater
)
[1] => Array
(
[date] => 2010/01/02
[character] => Lisa Turtle
)
[2] => Array
(
[date] => 2010/01/03
[character] => Kelly Kapowski
)
)
Using array_intersect gives the following error: "Object of class stdClass could not be converted to string".
Here's what I'd like to get, if it's possible (ie $arr3):
Array
(
[0] => stdClass Object
(
[date] => 2010/01/01
[name] => Mario Lopez
[character] => AC Slater
)
[1] => stdClass Object
(
[date] => 2010/01/02
[name] => Lark Voorhies
[character] => Lisa Turtle
)
[2] => stdClass Object
(
[date] => 2010/01/03
[character] => Kelly Kapowski
)
)