On Tue, Jul 2, 2013 at 9:40 AM, Thomas Gries <m...@tgries.de> wrote: > PHP codestyle question re. isset( $array['key'][0] ) versus > array_key_exists( 0, $array['key'] ) > > On a recent patch [1], we had a discussion what is - or may be - better > > * isset( $array['key'][0] ) > * array_key_exists( 0, $array['key'] ) >
In my opinion, isset() is usually clearer and "more natural", in part because you don't have to guess/memorize the order of parameters (which is haystack again, and which is needle?). There is however a functional difference: if your array can contain null as a valid value, then isset() can give you a false negative. So beware... -- brion _______________________________________________ Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l