|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #329 inconsistency with if-elseif-else-endif loops
Submitted: 1998-04-29 07:15 UTC Modified: 1998-04-29 09:34 UTC
Avg. Score:5.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: info at wizards dot dk Assigned:
Status: Closed Package: Parser error
PHP Version: 3.0 Release Candidate 4 OS: FreeBSD
Private report: No CVE-ID: None
 [1998-04-29 07:15 UTC] info at wizards dot dk
I think this is a bug - if it is supposed
to be this way, I sure don't see the

In PHP3 you're supposed to use ":"
instead of ";" between the different
statements in a if-elseif-else-endif

This doesn't seem to be the case
when writing to a file with the
"fputs" command?!?!?

This e.x. will not work:

<?$fd = popen("/usr/sbin/sendmail -t","w"); 
fputs($fd, "to:\n"); 
fputs($fd, "from:\n"); 
fputs($fd, "subject: header\n\n");
fputs($fd, "\n\n"); 
$a=1; if($a=1):
fputs($fd, "line1\n"):
fputs($fd, "line2\n");

To make it work I had to use
";" instead of ":" in the first
fputs line - like this:

fputs($fd, "line1\n");

otherwise it will not work???

Try out this url - where I have
an example running and see the
parse error message it produces:

Best Regards
Keld Vraakjaer


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [1998-04-29 09:34 UTC] zeev
You misunderstood it.  The statement seperator
doesn't change from ; to : inside if blocks (or anywhere
else, for that matter).  It remains ;.

Colons are used only after if (), elseif () and else,
mainly because one full
if ():
elseif ():

is one statement.

PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Tue Oct 03 23:01:26 2023 UTC