#28200 [NEW]: string comparing
| From: | mikael dot suvi at trigger dot ee | Date: | Wed, 28 Apr 2004 07:51:13 +0000 |
| Subject: | #28200 [NEW]: string comparing | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-58931@lists.php.net to get a copy of this message | ||
From: mikael dot suvi at trigger dot ee
Operating system: Linux
PHP version: 4.3.5
PHP Bug Type: Strings related
Bug description: string comparing
Description:
------------
By comparing strings that contain only numbers and are longer that certain
length give strange results. When using === I get the correct results.
Does that mean that when comparing strings one should use ONLY === and not
==.
Reproduce code:
---------------
<?
$str = "1111111111111111111";
$str1 = "1111111111111111112";
if ($str == $str1) print "equal";
?>
Actual result:
--------------
equal
--
Edit bug report at http://bugs.php.net/?id=28200&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=28200&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=28200&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=28200&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=28200&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=28200&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=28200&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=28200&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=28200&r=support
Expected behavior: http://bugs.php.net/fix.php?id=28200&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=28200&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=28200&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=28200&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=28200&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=28200&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=28200&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=28200&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=28200&r=float