i have these two associative arrays
// the needle array
$a = array(
\"who\" => \"you\",
\"what\" => \"thing\",
\"where\" => \
you can look into the php's array_diff_assoc() function or the array_intersect() function.
Here's a sample on counting the matched values:
<?php
$a = array(
"who" => "you",
"what" => "thing",
"where" => "place",
"when" => "hour"
);
// the haystack array
$b = array(
"when" => "time",
"where" => "place",
"who" => "you",
"what" => "thing"
);
$c = count(array_intersect($a, $b));
echo $c;
?>
CODEPAD link.