|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #37554 strange behavior of intval()
Submitted: 2006-05-22 22:29 UTC Modified: 2006-05-23 06:28 UTC
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: hsunke at muenster dot de Assigned:
Status: Not a bug Package: Math related
PHP Version: 5.1.4 OS: Debian Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: hsunke at muenster dot de
New email:
PHP Version: OS:


 [2006-05-22 22:29 UTC] hsunke at muenster dot de
I know about "unpredictable" issues with floatingpoint calculations, but this one is quite funny:

echo intval(100*(27/100));
//output: 27
echo intval(100*(28/100));
//output: 28
echo intval(100*(29/100));
//output: 28
echo intval(100*(30/100));
//output: 30
echo intval(100*(31/100));
//output: 31

Reproduce code:
echo intval(100*(29/100));

Expected result:

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-05-23 06:28 UTC]
Might be funny... but it's still the same problem.
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Sat Aug 13 15:05:45 2022 UTC