Bug #53204 [Com]: IF Statement Long String

From: Date: Sat, 30 Oct 2010 21:04:52 +0000
Subject: Bug #53204 [Com]: IF Statement Long String
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-155645@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=53204&edit=1

 ID:                 53204
 Comment by:         phristen at yahoo dot com
 Reported by:        diemuzi at gmail dot com
 Summary:            IF Statement Long String
 Status:             Open
 Type:               Bug
 Package:            Unknown/Other Function
 Operating System:   Archlinux
 PHP Version:        5.3.3
 Block user comment: N

 New Comment:

PHP integers are 32 bit.
The actual value of $o is not what you think it is... Do this:
var_dump($o);


Previous Comments:
------------------------------------------------------------------------
[2010-10-29 22:50:14] diemuzi at gmail dot com

Description:
------------
I was testing long strings of numbers against an IF statement (see test)
script and it was outputting information which was not true.

Test script:
---------------
This works:

$o = 33;
if ($o >= 29 && $o <= 32)
{
    echo "true";
} else {
    echo "false";
}

This does not work:

$o = 336571324099282374385465584513479344133;
if ($o >= 336571324099282374385465584513479344129 && $o <=
336571324099282374385465584513479344132)
{
    echo "true";
} else {
    echo "false";
}

Expected result:
----------------
In the working example, the output should be false. This is working as
expected.

In the non-working example, the output should be false. However, it is
returning true.



------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=53204&edit=1


Thread (3 messages)

« previous php.bugs (#155645) next »