|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2002-01-07 15:00 UTC] jacob at keystreams dot 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.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 19:00:02 2025 UTC |
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