|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2013-12-05 10:15 UTC] gnjagi at gmail dot com
Description:
------------
For loop with $i zero padded gives unexpected behaviour
Test script:
---------------
for($i=010;$i<20;$i++){
echo $i."<br/>";
}
echo "<br/>";
for($i=025;$i<50;$i++){
echo $i."<br/>";
}
echo "<br/>";
for($i=033;$i<60;$i++){
echo $i."<br/>";
}
Expected result:
----------------
The $i value is not what is stated in the for loop
Actual result:
--------------
http://softlogic.me.ke/numconv.php
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 09 01:00:01 2025 UTC |
for($i=010;$i<20;$i++){ echo $i."<br/>"; } expected is a loop with 10- 19 for($i=025;$i<50;$i++){ echo $i."<br/>"; } expected is a loop with 25- 49 for($i=025;$i<50;$i++){ echo $i."<br/>"; } expected is a loop with 33- 59 the actual result as you see in the link is something else