mysql_fetch_array (and probably others) return a key with 'null' as the
value if the field is null. This is distinct from that field not having
been returned at all/not existing.

-- 
|> /+\ \| | |>

David Croft
Infotrek
On Mon, 30 Apr 2001, Zeev Suraski wrote:

> Why would you care if a key exists and is null?  In general the behavior is
> so close to isset() that it's annoying to have to introduce a whole new
> function just for this difference.
>
> Zeev
>
> At 04:50 30/4/2001, David Croft wrote:
>
> >There doesn't seem to be any way for a php script to determine whether a
> >given key exists in an array. isset($arr['x']) fails when it exists but
> >has a null value. I know there are ways around it like using foreach or
> >array_keys but these don't seem very efficient.
> >
> >I would like to add a function key_exists, with the following proto:
> >
> >bool key_exists(array search, string key)
> >
> >Please let me know if this is inappropriate or I have missed something
> >obvious, otherwise I shall add this tomorrow. Thanks,
> >
> >David.
> >
> >--
> >|> /+\ \| | |>
> >
> >David Croft
> >Infotrek
> >
> >
> >--
> >PHP Development Mailing List <http://www.php.net/>
> >To unsubscribe, e-mail: [EMAIL PROTECTED]
> >For additional commands, e-mail: [EMAIL PROTECTED]
> >To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
> --
> Zeev Suraski <[EMAIL PROTECTED]>
> CTO &  co-founder, Zend Technologies Ltd. http://www.zend.com/
>
>
> --
> PHP Development Mailing List <http://www.php.net/>
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to