Bug #53204 [Opn->Bgs]: IF Statement Long String
| From: | aharvey@php.net | Date: | Tue, 02 Nov 2010 02:51:05 +0000 |
| Subject: | Bug #53204 [Opn->Bgs]: IF Statement Long String | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-155696@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
Updated by: aharvey@php.net
Reported by: diemuzi at gmail dot com
Summary: IF Statement Long String
-Status: Open
+Status: Bogus
Type: Bug
Package: Unknown/Other Function
Operating System: Archlinux
PHP Version: 5.3.3
Block user comment: N
New Comment:
As comment #1 indicates, this is due to the fact that you're actually
dealing with floating point values, not integers.
Not a bug -> closing.
Previous Comments:
------------------------------------------------------------------------
[2010-10-30 23:04:52] phristen at yahoo dot com
PHP integers are 32 bit.
The actual value of $o is not what you think it is... Do this:
var_dump($o);
------------------------------------------------------------------------
[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