Bug #54458 [NEW]: Comparison with intval()
| From: | cs dot luizeduardo at hotmail dot com | Date: | Sun, 03 Apr 2011 15:31:45 +0000 |
| Subject: | Bug #54458 [NEW]: Comparison with intval() | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-159932@lists.php.net to get a copy of this message | ||
From:
Operating system: Windows
PHP version: 5.3SVN-2011-04-03 (SVN)
Package: Variables related
Bug Type: Bug
Bug description:Comparison with intval()
Description:
------------
comparisons with intval() function with real values between 1 and 2 (like
1.2 1.3
etc).
Every return any fail;
Test script:
---------------
$numero = "1.1";
if (intval($numero * 100) == $numero * 100)
{
echo intval($numero * 100) . ":" . $numero * 100 . "<br/>";
echo "Number OK!";
} else {
echo intval($numero * 100) . ":" . $numero * 100 . "<br/>"; //Return
110:110 (same) but the comparison has fail
echo "The number shoud contains 2 decimal places";
}
Expected result:
----------------
110:110
Number OK!
OBS: With the variable with the 2.1 for example, the return result are the
expected.
Actual result:
--------------
110:110
The number shoud contains 2 decimal places
--
Edit bug report at http://bugs.php.net/bug.php?id=54458&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=54458&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=54458&r=trysnapshot53
Try a snapshot (trunk): http://bugs.php.net/fix.php?id=54458&r=trysnapshottrunk
Fixed in SVN: http://bugs.php.net/fix.php?id=54458&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=54458&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=54458&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=54458&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=54458&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=54458&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=54458&r=support
Expected behavior: http://bugs.php.net/fix.php?id=54458&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=54458&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=54458&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=54458&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=54458&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=54458&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=54458&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=54458&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=54458&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=54458&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=54458&r=mysqlcfg