Bug #15064 Updated: for loops do not work properly (is it a feature or a bug?)
| From: | torben@php.net | Date: | Wed, 16 Jan 2002 08:11:44 +0000 |
| Subject: | Bug #15064 Updated: for loops do not work properly (is it a feature or a bug?) | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-77217@lists.php.net to get a copy of this message | ||
ID: 15064
Updated by: torben
Reported By: nohn@php.net
Status: Bogus
Bug Type: Feature/Change Request
Operating System: Windows NT 4
PHP Version: 4.1.1
New Comment:
Check the manual; this is the way for loops work:
From page http://www.php.net/manual/en/control-structures.for.php
for (expr1; expr2; expr3) statement
The first expression (expr1) is evaluated (executed) once
unconditionally at the beginning of the loop.
In the beginning of each iteration, expr2 is evaluated. If
it evaluates to TRUE, the loop continues and the nested
statement(s) are executed. If it evaluates to FALSE, the
execution of the loop ends.
At the end of each iteration, expr3 is evaluated
(executed).
Hope this helps,
Torben
Previous Comments:
------------------------------------------------------------------------
[2002-01-16 03:05:03] yohgaki@php.net
This is not bug.
Most language behave as PHP does.
------------------------------------------------------------------------
[2002-01-16 03:01:03] nohn@php.net
for ($i=1; $i==20; $i++) {
echo($i);
}
does not work, while
for ($i=1; $i>=20; $i++) {
echo($i);
}
works fine. of course, if the first statement would work it wourld be
redundant, so my questions is: is it a feature or a bug?
------------------------------------------------------------------------
Edit this bug report at http://bugs.php.net/?id=15064&edit=1