Bug #14915 Updated: for statement returns nothing.
| From: | torben@php.net | Date: | Mon, 07 Jan 2002 20:26:21 +0000 |
| Subject: | Bug #14915 Updated: for statement returns nothing. | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-76213@lists.php.net to get a copy of this message | ||
ID: 14915
Updated by: torben
Reported By: jacob@keystreams.com
Old Status: Open
Status: Bogus
Bug Type: Unknown/Other Function
Operating System: Linux 2.4.9
PHP Version: 4.1.0
New Comment:
No bug; the code you have here is perfectly valid,
although it contains one of those irritatingly hard-to-catch
typo bugs. The semicolon indicates an empty statement. Your
code says essentially "For every value of $i from $start up
to and including 10, do nothing--then echo 'something'".
For instance, the following are equivalent:
for ($i = 1; $i <= 10; $i++) {}
...and...
for ($i = 1; $i <= 10; $i++);
Cheers,
Torben
Previous Comments:
------------------------------------------------------------------------
[2002-01-07 15:00:36] jacob@keystreams.com
when issuing the following syntactically incorrect 'for' statement
nothing was returned (note the semi-colon before the parenthesis) even
though at least one loop should take place. Should not a parse error be
returned?
for ($i = $start; $i <= 10; $i++); {
echo 'something';
}
'./configure' '--with-mysql' '--with-apache=../apache_1.3.22'
'--enable-track-vars' '--with-curl' '--with-dom'
'--with-zlib'
This is a public/production server so debugging is turned off.
------------------------------------------------------------------------
Edit this bug report at http://bugs.php.net/?id=14915&edit=1