Compare 2 array values in 2 arrays Php

admin

Administrator
Staff member
I have deleted the old post to make this more clear. I have 2 arrays that I need to compare and match but only if 2 values per array are the same.

Code:
$array1 = $plugins
<br>
Code:
$array2 = $xml_dump

A sample of what both arrays look like:

Code:
$plugins 

Array
(
    [all] =&gt; Array
        (
            [ajax-category-dropdown/dhat-ajax-cat-dropdown.php] =&gt; Array
                (
                    [Name] =&gt; Ajax Category Dropdown
                    [PluginURI] =&gt; http://www.example.com/ajax/
                    [Version] =&gt; 0.1.5
                    [Description] =&gt; Generates multi-level ajax. 
                    [Author] =&gt; DyasonHat
                    [AuthorURI] =&gt; http://www.dyasonhat.com
                    [Title] =&gt; Ajax Category Dropdown
                    [AuthorName] =&gt; Dya
                )

            [akismet/akismet.php] =&gt; Array
                (
                    [Name] =&gt; Akismet
                    [PluginURI] =&gt; http://akismet.com/
                    [Version] =&gt; 2.5.3
                    [Description] =&gt; Used by millions
                    [Author] =&gt; Automattic
                    [AuthorURI] =&gt; http://automattic.com/
                    [Title] =&gt; Akismet
                    [AuthorName] =&gt; Automattic
                )


$xml_dump
SimpleXMLElement Object
(
    [plugin] =&gt; Array
        (
            [0] =&gt; SimpleXMLElement Object
                (
                    [name] =&gt; Ajax Category Dropdown
                    [ex_version] =&gt; 0.1.5
                    [ex_date] =&gt; 2008-01-03
                    [plugin_url] =&gt; http://wordpress.org/extend/plugins/wp-contactform/
                    [advisory_url] =&gt; http://osvdb.org/show/osvdb/43284
                )

            [1] =&gt; SimpleXMLElement Object
                (
                    [name] =&gt; WP-ContactForm
                    [ex_version] =&gt; 2.0.7
                    [ex_date] =&gt; 2008-01-03
                    [plugin_url] =&gt; http://wordpress.org/extend/plugins/wp-contactform/
                    [advisory_url] =&gt; http://osvdb.org/show/osvdb/43284
                )

            [2] =&gt; SimpleXMLElement Object
                (
                    [name] =&gt; Math Comment Spam Protection
                    [ex_version] =&gt; 2.1
                    [ex_date] =&gt; 2008-01-03
                    [plugin_url] =&gt; http://wordpress.org/extend/plugins/math-comment-spam-protection/
                    [advisory_url] =&gt; a
                )

I need it to return the value ( or return true) only if $array1
Code:
Name
,
Code:
Version
matches $array2
Code:
name
,
Code:
ex_version

In the example above you can see that

Code:
$array1
Name =&gt; Ajax Category Dropdown
Version =&gt; 0.1.5

///has a match in 

$array2
name =&gt; Ajax Category Dropdown
ex_version =&gt; 0.1.5

I have tried many variations of
Code:
array_intersect
but I cannot get it to match 2 values for each array.