PHP array_key_exists vs. isset()

Which of these PHP statements do you think is faster:

array_key_exists($key, $array);




If you said “isset”, you’d be right! It is approximately 60% faster, as others have noted.

This is counter-intuitive, and seems like a very easy optimization could be made to bring the performance of array_key_exists() up to par with isset().

Leave a Reply

Your email address will not be published. Required fields are marked *