#25365 [Bgs]: negation of === does not work
| From: | derick@php.net | Date: | Tue, 02 Sep 2003 19:13:32 +0000 |
| Subject: | #25365 [Bgs]: negation of === does not work | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-47085@lists.php.net to get a copy of this message | ||
ID: 25365
Updated by: derick@php.net
Reported By: daniel dot oger at swing dot be
Status: Bogus
Bug Type: Variables related
Operating System: win xP Pro
PHP Version: 4.3.3
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
This is exactly what should happen
it is evaluated as
if ((!$result) === FALSE)
which of course is FALSE as !$result <=> TRUE (0 is considered as
FALSE):
<?php
$r = 0; var_dump(!$r);
?>
bool(true)
Previous Comments:
------------------------------------------------------------------------
[2003-09-02 14:12:35] pollita@php.net
That's because you're supposed to use "!==", i.e.:
if ($result !== FALSE)
echo "ZERO";
else
echo "EMPTY";
------------------------------------------------------------------------
[2003-09-02 14:03:38] daniel dot oger at swing dot be
Description:
------------
The === operator does not work if preceeded with !
Reproduce code:
---------------
$result=0; // number zero
if (!$result === FALSE)
echo "ZERO";
else
echo "EMPTY";
Expected result:
----------------
ZERO
Actual result:
--------------
EMPTY
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=25365&edit=1