On Thu, 3 May 2001, Andi Gutmans wrote:

> At 08:53 AM 5/3/2001 -0500, Andrei Zmievski wrote:
> >Um, but some db extensions return NULL values as part of the array, so
> >if column 'foo' is NULL in the db, you'd want the result array to have
> >NULL under key 'foo' - it just won't do to have that column be missing.
> Yeah but you can use === NULL for those.
> You might be right but I remember we decided it's problematic.

With all due respect Andi, you can't. There is a difference between a
field being null and that field not existing at all that neither isset,
empty nor === will detect.

david@papaya:~$ php
$arr['field'] = null;

$r1 = ($arr['field'] === null);
$r2 = ($arr['blah'] === null);

$r1 = (isset($arr['field']));
$r2 = (isset($arr['blah']));

$r1 = (empty($arr['field']));
$r2 = (empty($arr['blah']));

$r1 = (key_exists('field', $arr));
$r2 = (key_exists('blah', $arr));


Out of the four, only key_exists makes the distinction.

I know you had mentioned a problem with Zend not being able to unset
certain fields and instead setting them to null. May I suggest instead
that be attended to - if nothing else, by adding a new 'does not exist'
marker to the bucket that the zend_hash_ functions will recognize.

In the meantime a very large note can be added to the documentation if you
are able to determine exactly what circumstances cause this behaviour.



|> /+\ \| | |>

David Croft

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