note 44966 added to types.comparisons
| From: | rabbott at calstatela dot edu | Date: | Sat, 21 Aug 2004 15:09:19 +0000 |
| Subject: | note 44966 added to types.comparisons | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-75058@lists.php.net to get a copy of this message | ||
How can this be justified?
$boolVal = "00" == "0";
echo "test: $boolVal;<br>";
produces:
test: 1;
We are presumably comparing the two strings "00" and "0". They shouldn't
compare as equal.
I guess that the answer is that both are cast to numbers since
$boolVal = "0000005" == "5.000000";
echo "test: $boolVal;<br>";
also produces
test: 1;
----
Manual Page -- http://www.php.net/manual/en/types.comparisons.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+44966
Delete -- http://master.php.net/manage/user-notes.php?action=delete+44966&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+44966&report=yes
Search -- http://master.php.net/manage/user-notes.php