NYCPHP Meetup

NYPHP.org

[nycphp-talk] Accessing non-existent array elements ok?

Michael B Allen ioplex at gmail.com
Sun Aug 17 18:42:58 EDT 2008


On Sun, Aug 17, 2008 at 4:57 PM, justin <justin at justinhileman.info> wrote:
> On Sun, Aug 17, 2008 at 4:49 PM, Michael B Allen <ioplex at gmail.com> wrote:
>> Is it ok to access non-existent array elements?
>>
>> Will accessing an array element using a key that does not exist always
>> return NULL?
>
> it depends on how you have warnings configured. you might be getting
> them in your log, for example... i believe the result of accessing a
> non-existent array element is undefined.

Ok.

Bummer. I think I would prefer that it a non-existent index evaluate to NULL.

Mike



More information about the talk mailing list