Within a foreach iteration in PHP, I wish to check if the value of a key in one array is equal to the value of a different key in another array.
$array1 = array(word1=>"hello",word2=>"world");
$array2 = array(word1=>"hello",word2=>"peter");
I.e. Foreach $array1 as $element if $element [word1=>value] == $array2[word2=>value]
in_array doesn't seem to be specific enough, since it only looks for the value anywhere in the array. I want just to check for its existence as part of a specific key value pair.
if($arr[$key1] == $arr2[$key2])Does you means something like this?