If...Else question

From: Date: Thu, 14 Mar 2002 15:51:37 +0000
Subject: If...Else question
Groups: php.general 
Request: Send a blank email to php-general+get-88527@lists.php.net to get a copy of this message
Is it legal for an if...else statement to span PHP code blocks? Here's an example: <? $a = 0; if ($a < 5) { $b = 50; $c=500; // Take a break from php and put in some HTML ?> <HTML> <HEAD></HEAD> <BODY>MORE HTML CODE HERE</BODY> </HTML> <? // Now back to the PHP code $d = 250; } else { $e = "Does not apply." } ?> I have some code similar to this example. When I run the code in my browser, I get a parse error on the last line (?>).

« previous php.general (#88527) next »