#25763 [NEW]: Why the string "1.10" is equal to the string "1.1"?
| From: | jparneodo at yahoo dot fr | Date: | Mon, 06 Oct 2003 18:08:02 +0000 |
| Subject: | #25763 [NEW]: Why the string "1.10" is equal to the string "1.1"? | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-48590@lists.php.net to get a copy of this message | ||
From: jparneodo at yahoo dot fr
Operating system: RH7.2
PHP version: 4.3.3
PHP Bug Type: Strings related
Bug description: Why the string "1.10" is equal to the string "1.1"?
Description:
------------
I excepted true if one of the compared variable was numeric,
because of type juggling rules (Appendix K. PHP type comparison tables),
but false when the 2
variables are string.
In this case == and === must have the same result.
Reproduce code:
---------------
$a=(string)"1.1";
$b=(string)"1.10";
if($a==$b) echo "equal";
else echo "different";
Expected result:
----------------
different
Actual result:
--------------
equal
--
Edit bug report at http://bugs.php.net/?id=25763&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=25763&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=25763&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=25763&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=25763&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=25763&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=25763&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=25763&r=support
Expected behavior: http://bugs.php.net/fix.php?id=25763&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=25763&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=25763&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=25763&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=25763&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=25763&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=25763&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=25763&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=25763&r=float