note 103248 added to language.operators.comparison
| From: | ensnnet at gmail dot com | Date: | Sun, 03 Apr 2011 21:20:53 +0000 |
| Subject: | note 103248 added to language.operators.comparison | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-178453@lists.php.net to get a copy of this message | ||
The next code:
<?php
$a = "12E0";
$b = "12";
if($a==$b)
echo "Equals";
else
echo "Not equals";
?>
Show: Equals
I think that the reason is that "12E0" is evaluated as 12 x 10 exp(0) = 12 and then the
two strings are compared as integers.
----
Server IP: 69.147.83.197
Probable Submitter: 95.21.91.75
----
Manual Page -- http://www.php.net/manual/en/language.operators.comparison.php
Edit -- https://master.php.net/note/edit/103248
Del: integrated -- https://master.php.net/note/delete/103248/integrated
Del: useless -- https://master.php.net/note/delete/103248/useless
Del: bad code -- https://master.php.net/note/delete/103248/bad+code
Del: spam -- https://master.php.net/note/delete/103248/spam
Del: non-english -- https://master.php.net/note/delete/103248/non-english
Del: in docs -- https://master.php.net/note/delete/103248/in+docs
Del: other reasons-- https://master.php.net/note/delete/103248
Reject -- https://master.php.net/note/reject/103248
Search -- https://master.php.net/manage/user-notes.php