note 102151 added to control-structures.else

From: Date: Sat, 29 Jan 2011 22:36:19 +0000
Subject: note 102151 added to control-structures.else
Groups: php.notes 
Request: Send a blank email to php-notes+get-176503@lists.php.net to get a copy of this message
Larry H-C's example is syntactically incorrect, that's why it doesn't work. It has nothing to do with dropping out into HTML mode. His code is equivalent to: <?php if ($condition) { doSomething(); } // putting any code here, even HTML, will cause an error, because when the interpreter reaches the "else" on the next line, it will be completely out of context and it won't know what to do with it. else { doSomethingElse(); } ?> In other words, an if...else construct is a single entity - you can't go shoving code into the middle of it willy-nilly. I hope this avoids potential confusion. ---- Server IP: 69.147.83.197 Probable Submitter: 86.155.101.146 ---- Manual Page -- http://www.php.net/manual/en/control-structures.else.php Edit -- https://master.php.net/note/edit/102151 Del: integrated -- https://master.php.net/note/delete/102151/integrated Del: useless -- https://master.php.net/note/delete/102151/useless Del: bad code -- https://master.php.net/note/delete/102151/bad+code Del: spam -- https://master.php.net/note/delete/102151/spam Del: non-english -- https://master.php.net/note/delete/102151/non-english Del: in docs -- https://master.php.net/note/delete/102151/in+docs Del: other reasons-- https://master.php.net/note/delete/102151 Reject -- https://master.php.net/note/reject/102151 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#176503) next »