[development] something interesting about isset and array_key_exists

Karoly Negyesi karoly at negyesi.net
Wed Jan 11 20:01:21 UTC 2006


Hi!

As you might know, isset is preferred over array_key_exists because isset  
being a language construct it's a lot faster. I was under the impression  
that isset($array['foo']) and array_key_exists('foo', $array) is the same  
all the time. However, it's not. Yes, that's documented in the PHP manual  
but I think it's worth mentioning because we are now working with arrays a  
lot more: isset() does not return TRUE for array keys that correspond to a  
NULL value, while array_key_exists() does.

Regards

NK


More information about the development mailing list