note 68904 deleted from control-structures.else by bjori

From: Date: Fri, 14 Dec 2007 20:00:45 +0000
Subject: note 68904 deleted from control-structures.else by bjori
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-133479@lists.php.net to get a copy of this message
Note Submitter: jsimlo ---- This generates a parser error: <? if ($a == 1): /* nested if */ if ($b == 2) echo '2'; else: /* other code */ endif; ?> The nested "if" binds the outer "else" and the colon then generates a parser error. As this "bug" is not going to be fixed (see http://bugs.php.net/bug.php?id=838), this could be an artful solution to this problem: <? if ($a == 1): /* nested if */ if ($b == 2) echo '2'; /* dummy expression */ ; else: /* other code */ endif; ?>

« previous php.notes (#133479) next »