php.net |  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
Votes:1
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
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: info at wizards dot dk
New email:
PHP Version: OS:

 

 [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
why?!?

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

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: someone@somewhere.com\n"); 
fputs($fd, "from: someone@somewhere.com\n"); 
fputs($fd, "subject: header\n\n");
fputs($fd, "\n\n"); 
$a=1; if($a=1):
fputs($fd, "line1\n"):
fputs($fd, "line2\n");
endif;
pclose($fd)?>

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:

http://wizards.dk/hotel/mf/shop/test.phtml

Best Regards
Keld Vraakjaer

Patches

Pull Requests

History

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 ():
  ...
else:
  ...
endif;

is one statement.

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Nov 09 23:01:30 2024 UTC