note 40648 added to language.types.string
| From: | ibaldo at esquemas dot com | Date: | Wed, 10 Mar 2004 16:23:23 +0000 |
| Subject: | note 40648 added to language.types.string | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-66561@lists.php.net to get a copy of this message | ||
Beware of this one! It says "Impossible" where the numbers are clearly different and they
are strings in the 1st place.
I don't know why PHP wants to convert a string to number just for comparing it and give the
wrong result because it truncated the numbers!
So be cautious when you write your code.
if ("078042005027092025011082094117019026011" ==
"078042005027092025011082094054019026011")
echo 'Impossible!';
else
echo 'Ok, they are different!';
----
Manual Page -- http://www.php.net/manual/en/language.types.string.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+40648
Delete -- http://master.php.net/manage/user-notes.php?action=delete+40648&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+40648&report=yes
Search -- http://master.php.net/manage/user-notes.php