|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #2730 for loop ignores fractions
Submitted: 1999-11-16 14:38 UTC Modified: 2001-02-10 15:48 UTC
From: kevin at dope dot de Assigned:
Status: Closed Package: Parser error
PHP Version: 3.0.12 OS: Linux 2.0.36
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: kevin at dope dot de
New email:
PHP Version: OS:


 [1999-11-16 14:38 UTC] kevin at dope dot de
When I use this script with my employer's computer (Linux 2.0.36, Apache 1.3.9, PHP 3.0.12, OCI8 and Oracle):

for ($i=0; $i<10; $i += .5) {
        echo $i . "<br>";

I get an infinite loop, because $i remains zero. If I increment $i with 1.5 each time, it gets actually incremented with 1, so it seems like the increment is floor()'ed before.
The script runs perfectly on my workstation (Linux 2.2.13, Apache 1.3.4, PHP3.0.7, MySQL).


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [1999-11-16 15:27 UTC] kevin at dope dot de
It works if I use
instead of
And there is no php.ini on either computer
 [2000-08-17 15:43 UTC]
this is locale-dependant, it has been fixed for 
php4 but not php3

as a workaround use setlocale("C",LC_ALL)
 [2001-02-10 15:48 UTC]
duplicate of 2260.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Wed Dec 06 18:01:28 2023 UTC