#45223 [Bgs->Opn]: else if (...): unexpected T_IF, expecting ':'

From: Date: Tue, 10 Jun 2008 08:49:22 +0000
Subject: #45223 [Bgs->Opn]: else if (...): unexpected T_IF, expecting ':'
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-876@lists.php.net to get a copy of this message
ID: 45223 Updated by: mgf@php.net Reported By: ms419 at freezone dot co dot uk -Status: Bogus +Status: Open -Bug Type: *General Issues +Bug Type: Documentation problem PHP Version: 5.2.6 New Comment: Oh, I beg your pardon -- responded too quickly and with insufficient coffee level! Looks like a documentation problem to me, and will be specific to the alternative ":"-style syntax. Previous Comments: ------------------------------------------------------------------------ [2008-06-10 08:45:43] mgf@php.net Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php Well, you\'ve just proved that \"else if\" is *not* identical to \"elseif\"! The error message is self-explanatory. ------------------------------------------------------------------------ [2008-06-09 20:44:51] ms419 at freezone dot co dot uk Description: ------------ PHP documentation claims: "In PHP, you can also write 'else if' (in two words) and the behavior would be identical to the one of 'elseif' (in a single word). The syntactic meaning is slightly different (if you're familiar with C, this is the same behavior) but the bottom line is that both would result in exactly the same behavior." - http://php.net/elseif However I get the following error: Parse error: syntax error, unexpected T_IF, expecting ':' in /home/jablko/public_html/test.php on line 3 Reproduce code: --------------- <?php if (false): ?> AAA <?php else if (true): ?> BBB <?php else: ?> CCC <?php endif; ?> Expected result: ---------------- BBB Actual result: -------------- Parse error: syntax error, unexpected T_IF, expecting ':' in /home/jablko/public_html/test.php on line 3 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=45223&edit=1

« previous php.doc.bugs (#876) next »