PHP 4.0 Bug #8582 Updated: normal if nested in alternate if gives parse error

From: Date: Mon, 08 Jan 2001 11:53:31 +0000
Subject: PHP 4.0 Bug #8582 Updated: normal if nested in alternate if gives parse error
Groups: php.dev 
Request: Send a blank email to php-dev+get-43353@lists.php.net to get a copy of this message
ID: 8582 Updated by: stas Reported By: wojas@vvtp.nl Old-Status: Open Status: Closed Bug Type: Scripting Engine problem Assigned To: Comments: 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. Previous Comments: --------------------------------------------------------------------------- [2001-01-07 20:09:41] wojas@vvtp.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. --------------------------------------------------------------------------- Full Bug description available at: http://bugs.php.net/?id=8582

« previous php.dev (#43353) next »