Commenting Out in PHP Versus HTML

Posted by Marty Dickinson on Jun 18, 2012

If you have something on your website that you want to remove, but you realize you might want to re-add it later, you might decide to “comment it out” instead of remove it altogether. Commenting out content just makes it easy to re-activate content instead of having to come up with the codes and/or image paths you used at one time.  I always remember how to comment out on a standard HTML page. But, the one that I always forget is how to comment out in PHP, which is just a bit different.

For example, if I have this sentence:

I really wish I could remember how to comment out php versus html code.

If this was in standard html, all I would have to add would be:
<!– I really wish I could remember how to comment out php versus html code. –>

But, if my website is produced in WordPress, the code is produced with PHP instead of straight HTML. So, the code is a little different.
<?php /* I really wish I could remember how to comment out php versus html code.  */ ?>

Pretty simple there. Give it a try sometime on your own. Then, next time you want to remove something from your website temporarily, you’ll know how to comment out PHP versus HTML and you won’t even have to contact your webmaster or designer to make the change for you.