|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2001-01-07 20:09 UTC] wojas at vvtp dot nl
The following php code gives a parse error at the 'else:'
<?php
if(1==1):
echo "ok so far<p>";
if(1==1) echo "error here!";
else:
echo "Not possible";
endif;
?>
It looks like php thinks the 'else:' is part of the second
if construct; the following code works:
<?php
if(1==1):
echo "ok so far<p>";
if(1==1) echo "error here!";
echo "void";
else:
echo "Not possible";
endif;
?>
Tested with 4.0.3pl1, 4.0.4RC3 and 3.0.18 on debian woody and potato.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Tue Jul 07 02:00:01 2026 UTC |
Indeed the parser thinks else is a part of second construct and chokes on ":". I'd suggest first to switch to newer {} syntax, and then bracket your ifs so that you are sure you and the parser agree on what is the part of what.