RE: [PHP] If...Else question
| From: | Vlad Kulchitski | Date: | Thu, 14 Mar 2002 16:01:29 +0000 |
| Subject: | RE: [PHP] If...Else question | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-88528@lists.php.net to get a copy of this message | ||
Of course it's legal, absolutely.
You have to make sure though that you
don't use double quotes in php portion,
and if you do, you have to escape them
for instance:
echo "<font color=\"red\">";
if you paste the code that's causing the
problem, we can take a look.
Vlad
-----Original Message-----
From: Brad Harriger [mailto:bradharriger@clarionhospital.org]
Sent: 14 березня 2002 р. 10:52
To: php-general@lists.php.net
Subject: [PHP] If...Else question
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 (?>).
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php