How does array_keys do the search for value?
How does PHP array_keys do the search for value? Example: $array2 = array("xyz", "xyz", "abc", "abc", "xyz", "xyz", "text", "abc", "text"); print_r(array_keys($array2,"abc")); Since they are key,value pairs. I am guessing PHP to do a search based on hash rather than iterate through each of the key-pairs in the array. Any 'clarity thoughts' on this? Question inspired by this question: How to get the keys of empty elements in an array if the corresponding element in a similar-sized array is a number (without iteration)? In the php source, they iterate through each key and value, one by one.