note 55343 added to function.is-null
| From: | MARSIK at osu1 dot php dot net | Date: | Sun, 31 Jul 2005 14:54:00 +0000 |
| Subject: | note 55343 added to function.is-null | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-92828@lists.php.net to get a copy of this message | ||
I've tested different values in order to compare 'em with NULL with the help of different
operators...
<?php
$arr=array(0, 0.0, '0', '0.0', '',FALSE,'false',NULL,
'NULL');
for ($i=0; $i<count($arr); $i++)
$arr[$i]=array(
$arr[$i],
((integer)($arr[$i]==NULL))
.((integer)($arr[$i]===NULL))
.((integer)is_null($arr[$i]))
);
var_dump($arr);
?>
it gave the following results:
0 : ==NULL
0.0 : ==NULL
'0' : nothing worked =)
'0.0' : nothing...
'' : ==NULL
FALSE : ==NULL
'false' : nothing
NULL : ==NULL, ===NULL, is_null()
'NULL' : nothing
enjoy =)
----
Submitter IP: 64.246.30.37
----
Manual Page -- http://www.php.net/manual/en/function.is-null.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+55343
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+55343&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+55343&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+55343&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+55343&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+55343&report=yes&reason=non-english
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+55343&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+55343&report=yes
Search -- http://master.php.net/manage/user-notes.php