ID: 30054 Updated by: [EMAIL PROTECTED] Reported By: jon at latchkey dot com -Status: Open +Status: Bogus Bug Type: Output Control Operating System: OSX PHP Version: 5.0.0 New Comment:
This is not a support forum. Please ask support questions on the appropriate mailing list. But your logic boils down to: if(true) echo "here1"; else <empty expression>; if(true) echo "here2"; if(true) echo "here3"; else if(true) echo "here4"; In the first part you don't have anything in your else clause as you never started a block using {...} so the expression ends with the end of the PHP block. In the second part the else expression only gets evaluated if the if condition was false. It doesn't matter that the condition after the else happens to be true, it won't be evaluated. Previous Comments: ------------------------------------------------------------------------ [2004-09-11 19:32:36] jon at latchkey dot com tell me why this is not a bug. sorry. ------------------------------------------------------------------------ [2004-09-11 19:31:52] jon at latchkey dot com tell me why this is a bug. ------------------------------------------------------------------------ [2004-09-11 15:18:48] [EMAIL PROTECTED] 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 ------------------------------------------------------------------------ [2004-09-10 18:21:27] jon at latchkey dot com Description: ------------ [6][ /private/tmp ]% cat test2.php <? function doA() { return true; } function doB() { return true; } ?> <? if (doA()) { ?>here1<? } else ?> <? if (doB()) { ?>here2<? } ?> <? if (doA()) { ?>here3<? ?> <? } else if (doB()) { ?>here4<? } ?> [7][ /private/tmp ]% php --version PHP 5.0.0 (cli) (built: Aug 3 2004 15:10:22) Copyright (c) 1997-2004 The PHP Group Zend Engine v2.0.0, Copyright (c) 1998-2004 Zend Technologies [8][ /private/tmp ]% php test2.php here1here2 here3 [9][ /private/tmp ]% Reproduce code: --------------- <? function doA() { return true; } function doB() { return true; } ?> <? if (doA()) { ?>here1<? } else ?> <? if (doB()) { ?>here2<? } ?> <? if (doA()) { ?>here3<? ?> <? } else if (doB()) { ?>here4<? } ?> Expected result: ---------------- here1here2 here3here4 (or a compile error) Actual result: -------------- here1here2 here3 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=30054&edit=1