At least in PHP 4.4.0, array_key_exists is inconsistently sensitive to different data types. For example, if your first argument is a double and the keys in your array are integers, array_key_exists will always return false. If you then cast the first argument to an integer, or even to a string, then you can successfully match. I haven't tested all the possibilities, to see when it'll tolerate different data types and when it won't, so the easiest and safest solution is to cast your first argument to match the data type of the keys.