distinguish between null variable and unset variable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



How can I tell the difference between a variable whose value is null and
a variable which is not set?

// cannot use === null:

ket% php -r '$null = null; var_dump(null === $null);'
bool(true)
ket% php -r 'var_dump(null === $unset);'             
bool(true)
ket% 

// - cannot use isset() either:

ket% php -r '$null = null; var_dump(isset($null));'       
bool(false)
ket% php -r 'var_dump(isset($unset));'               
bool(false)
ket% 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux