NYCPHP Meetup

[nycphp-talk] Is @$arr['key'] ok?

Kenneth Downs ken at secdat.com
Mon Mar 10 13:31:12 EDT 2008


Daniel Convissor wrote:
> On Mon, Mar 10, 2008 at 09:28:29AM -0400, Kenneth Downs wrote:
>   
>> function arraySafe($array,$key,$default='') {
>>  if(isset($array[$key]))
>>     return $array[$key];
>>  else
>>     return $default;
>> }
>>     
>
> Though this does get tripped up by $array[$key] being NULL.  
> array_key_exists() is more accurate.
>
> --Dan
>
>   
Good point.

-- 
Kenneth Downs
Secure Data Software, Inc.
www.secdat.com    www.andromeda-project.org
631-689-7200   Fax: 631-689-0527
cell: 631-379-0010

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20080310/8ebbd06d/attachment.html>


More information about the talk mailing list