combine 2 associative arrays where values match
<p>I have 2 associative arrays: $arr1 &amp; $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: </p>

<p>Here's $arr1:</p>

<pre><code>Array
(
[0] =&gt; stdClass Object
    (
        [date] =&gt; 2010/01/01
        [name] =&gt; Mario Lopez
    )

[1] =&gt; stdClass Object
    (
        [date] =&gt; 2010/01/02
        [name] =&gt; Lark Voorhies
    )

)
</code></pre>

<p>Here's $arr2:</p>

<pre><code>Array
(
[0] =&gt; Array
    (
        [date] =&gt; 2010/01/01
        [character] =&gt; AC Slater
    )

[1] =&gt; Array
    (
        [date] =&gt; 2010/01/02
        [character] =&gt; Lisa Turtle
    )
[2] =&gt; Array
    (
        [date] =&gt; 2010/01/03
        [character] =&gt; Kelly Kapowski
    )
)
</code></pre>

<p>Using array_intersect gives the following error: "Object of class stdClass could not be converted to string".</p>

<p>Here's what I'd like to get, if it's possible (ie $arr3):</p>

<pre><code>Array
(
[0] =&gt; stdClass Object
    (
        [date] =&gt; 2010/01/01
        [name] =&gt; Mario Lopez
        [character] =&gt; AC Slater
    )

[1] =&gt; stdClass Object
    (
        [date] =&gt; 2010/01/02
        [name] =&gt; Lark Voorhies
        [character] =&gt; Lisa Turtle
    )

[2] =&gt; stdClass Object
    (
        [date] =&gt; 2010/01/03
        [character] =&gt; Kelly Kapowski
    )

)
</code></pre>
