NYCPHP Meetup

NYPHP.org

[nycphp-talk] Handling empty values in hashes

John Campbell jcampbell1 at gmail.com
Thu Jul 17 14:43:26 EDT 2008


> operation works well,  but I find it pretty obnoxious that:
>
> (1) This throws warnings on a missing keys if a certain bit is set in
> error_reporting,  and
> (2) It's not possible to have strict checking of variable names without also
> turning on strict checking of array keys  (which I'd usually expect to be a
> bit sloppier)
>
> Any thoughts?

+1
The lack of a default dictionary in php does suck.  Of course one can
work around this with a function like issetor($array,$key,$default),
but in my opinion that makes for ugly code.

Of course it is possible to create a class with this behavior using
SPL, but that doesn't take care of the superglobals and there might be
performance problems.

-John Campbell



More information about the talk mailing list