[dev] CODING_STANDARDS / isset()

Marko Djukic marko at oblo.com
Tue Mar 25 03:09:43 PST 2003


this seems to be a bit confusing:
(line 512)
d. Use array_key_exists() when you want to check if an array key is
defined but it's OK if the value is false or null:

which seems to imply that in difference to the previous ways for testing a
variable, this one also accepts false as a value.

when:
  $t['param'] = false;
  var_dump(isset($t['param']));

gives the result 'true', meaning isset() does detect an array key having the
value false, and we do not have to rely on array_key_exists for these
situations. so the only difference would be that array_key_exists() would also
accept NULL as a value and still determine that an array key is defined.

committed a variation, if the way i understood things is ok.

m.


More information about the dev mailing list