php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #595 Parser error in for()
Submitted: 1998-07-29 12:02 UTC Modified: 1998-07-29 13:01 UTC
From: mbrennen at fni dot com Assigned:
Status: Closed Package: Parser error
PHP Version: 3.0.2a OS: Linux 2.0.x
Private report: No CVE-ID: None
 [1998-07-29 12:02 UTC] mbrennen at fni dot com
The following script gives a parser error:

for ( $i = 0;  $i < $k;  $i++; ) {  ...  }

Removing the semicolon after $i++ fixes it:

for ( $i = 0;  $i < $k;  $i++ ) {  ...  }

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1998-07-29 13:01 UTC] rasmus
How the heck is this a bug?  The 'for' construct is defined as for(expr;expr;expr) { }  An extra semi-colon does not match this definition.  Find me another language with a C-style for-construct that will accept your syntax and I will give you a cookie.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 13:01:31 2024 UTC