I deleted the old post to make this clearer. I have 2 arrays that I need to compare and match, but only if 2 values for each array are the same.
$array1 = $plugins
$array2 = $xml_dump
An example of how both arrays look:
$plugins
Array
(
[all] => Array
(
[ajax-category-dropdown/dhat-ajax-cat-dropdown.php] => Array
(
[Name] => Ajax Category Dropdown
[PluginURI] => http:
[Version] => 0.1.5
[Description] => Generates multi-level ajax.
[Author] => DyasonHat
[AuthorURI] => http:
[Title] => Ajax Category Dropdown
[AuthorName] => Dya
)
[akismet/akismet.php] => Array
(
[Name] => Akismet
[PluginURI] => http:
[Version] => 2.5.3
[Description] => Used by millions
[Author] => Automattic
[AuthorURI] => http:
[Title] => Akismet
[AuthorName] => Automattic
)
$xml_dump
SimpleXMLElement Object
(
[plugin] => Array
(
[0] => SimpleXMLElement Object
(
[name] => Ajax Category Dropdown
[ex_version] => 0.1.5
[ex_date] => 2008-01-03
[plugin_url] => http:
[advisory_url] => http:
)
[1] => SimpleXMLElement Object
(
[name] => WP-ContactForm
[ex_version] => 2.0.7
[ex_date] => 2008-01-03
[plugin_url] => http:
[advisory_url] => http:
)
[2] => SimpleXMLElement Object
(
[name] => Math Comment Spam Protection
[ex_version] => 2.1
[ex_date] => 2008-01-03
[plugin_url] => http:
[advisory_url] => a
)
I need to return a value (or return true), only if the $ of array1 Name, Versioncorresponds to $ array2 Name,ex_version
In the above example, you can see that
$array1
Name => Ajax Category Dropdown
Version => 0.1.5
///has a match in
$array2
name => Ajax Category Dropdown
ex_version => 0.1.5
I tried many options array_intersect, but I can not get it to correspond to 2 values for each array.
source
share