php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #14915 for statement returns nothing.
Submitted: 2002-01-07 15:00 UTC Modified: 2002-01-07 15:26 UTC
From: jacob at keystreams dot com Assigned:
Status: Not a bug Package: Unknown/Other Function
PHP Version: 4.1.0 OS: Linux 2.4.9
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: jacob at keystreams dot com
New email:
PHP Version: OS:

 

 [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.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-01-07 15:26 UTC] torben@php.net
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
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat May 10 23:01:29 2025 UTC