From: "Wei Wang" <[EMAIL PROTECTED]>

> This may sound very newbie. But since
> html comment uses <!-- --> which doesn't
> comment out the php code. And the php
> comment /**/ // apparently doesn't work
> on html. So how do I comment out a
> chunk of html/php mixed code?

/* and */ appears to work:

<?php

/*
echo "hello world";
?>
HTML
<?php
*/

echo "bye";

?>

That'll just display "bye"... You just have to start the comment in PHP mode
and end it in PHP mode. Any breaking out of PHP mode to display HTML will be
commented out.

If you have mostly HTML with some PHP thrown in that you want to comment
out, HTML comments will work, also, so long as you start the comment in HTML
mode and end it in HTML mode, like this:


HTML
<!--
HTML
<?php echo "hi"; ?>
HTML
-->
HTML

Which will just display "HTML" twice. The center part is commented out.

---John Holmes...

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to