php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #28200 string comparing
Submitted: 2004-04-28 09:51 UTC Modified: 2004-04-28 12:37 UTC
From: mikael dot suvi at trigger dot ee Assigned:
Status: Not a bug Package: Strings related
PHP Version: 4.3.5 OS: Linux
Private report: No CVE-ID: None
 [2004-04-28 09:51 UTC] mikael dot suvi at trigger dot ee
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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-04-28 12:37 UTC] derick@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

.
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Sun Dec 15 03:01:24 2019 UTC