Bug #14096 Updated: strange behavior with NULL value
ID: 14096
Updated by: derick
Reported By: david.phpnet@gazolinemm.com
Old Status: Open
Status: Bogus
Bug Type: Unknown/Other Function
Operating System: win2k
PHP Version: 4.0.6
New Comment:
It's perfectly normal. The "" gets converted to NULL here. Use === to check for both
contents and type.
Derick
Previous Comments:
------------------------------------------------------------------------
[2001-11-17 19:47:49] david.phpnet@gazolinemm.com
consider the following script:
$a = "";
$b = NULL;
echo $a == $b ? "true" : "false";
/* weird! it does return TRUE */
echo is_null($a) ? "true" : "false"; // returns FALSE
echo is_null($b) ? "true" : "false"; // returns TRUE
echo empty($a) ? "true" : "false"; // returns TRUE
echo empty($b) ? "true" : "false"; // returns TRUE
echo isset($a) ? "true" : "false"; // returns TRUE
echo isset($b) ? "true" : "false"; // returns FALSE
------------------------------------------------------------------------
Edit this bug report at http://bugs.php.net/?id=14096&edit=1
Thread (2 messages)