I have the following two arrays:
$array_one = array(\'colorZero\'=>\'black\', \'colorOne\'=>\'red\', \'colorTwo\'=>\'green\', \'colorThree\'=>\'b
As of PHP 5.1 there is array_intersect_key
(manual).
Just flip the second array from key=>value to value=>key with array_flip()
and then compare keys.
So to compare OP's arrays, this would do:
$result = array_intersect_key( $array_one , array_flip( $array_two ) );
No need for any looping the arrays at all.