note 72199 added to language.operators.comparison
| From: | stepheneliotdeweyatgmail | Date: | Sun, 07 Jan 2007 14:49:21 +0000 |
| Subject: | note 72199 added to language.operators.comparison | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-121384@lists.php.net to get a copy of this message | ||
Note that typecasting will NOT prevent the default behavior for converting two numeric strings to
numbers when comparing them.
e.g.:
if ((string) '0123' == (string) '123')
print 'equals';
else
print 'doesn\'t equal';
Still prints 'equals'
As far as I can tell the only way to avoid this is to use the identity comparison operators (=== and
!==).
----
Server IP: 64.71.164.2
Probable Submitter: 68.163.130.212
----
Manual Page -- http://www.php.net/manual/en/language.operators.comparison.php
Edit -- https://master.php.net/note/edit/72199
Del: integrated -- https://master.php.net/note/delete/72199/integrated
Del: useless -- https://master.php.net/note/delete/72199/useless
Del: bad code -- https://master.php.net/note/delete/72199/bad+code
Del: spam -- https://master.php.net/note/delete/72199/spam
Del: non-english -- https://master.php.net/note/delete/72199/non-english
Del: in docs -- https://master.php.net/note/delete/72199/in+docs
Del: other reasons-- https://master.php.net/note/delete/72199
Reject -- https://master.php.net/note/reject/72199
Search -- https://master.php.net/manage/user-notes.php