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'] )


This is still unclear after consultation of these pages

  * http://php.net/isset <http://php.net/isset,>
  * http://php.net/array_key_exists and
  * https://www.mediawiki.org/wiki/Manual:Coding_conventions/PHP#Pitfalls .

... I would prefer/array_key_exists/ .

Perhaps someone can explain why which one of the methods should be
preferred ?
The
https://www.mediawiki.org/wiki/Manual:Coding_conventions/PHP#Pitfalls
section should be improved with the explanation.


[1] https://gerrit.wikimedia.org/r/#/c/71258/ see comments for patchset 8
_______________________________________________
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Reply via email to