Re: How to comment out chunk of html/php mixed code?

From: Date: Mon, 15 Sep 2003 20:16:34 +0000
Subject: Re: How to comment out chunk of html/php mixed code?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-162656@lists.php.net to get a copy of this message
From: "Wei Wang" <ww220@cam.ac.uk> > 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...

« previous php.general (#162656) next »