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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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

Add a Patch

Pull Requests

Add a Pull Request

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-2024 The PHP Group
All rights reserved.
Last updated: Sat May 18 15:01:33 2024 UTC