PHP MySQL Tutorial
Learn PHP and MySQL

Using PHP Comments

Page Details

Published by:
admin
on 12-19-2008
2 people found this article useful.

100% of people found this useful
Using PHP Comments

Comment is a part of your PHP code that will not be translated by the PHP engine. You can use it to write documentation of your PHP script describing what the code should do. A comment can span only for one line or span multiple line.

PHP support three kinds of comment tags :

  1. //
    This is a one line comment
  2. #
    This is a Unix shell-style comment. It's also a one line comment
  3. /* ..... */
    Use this multi line comment if you need to.

 

<?php
echo "First line <br>"; // You won't see me in the output
// I'm a one liner comment

/*
Same thing, you won't
see this in the output file

*/
echo "The above comment spans two lines <br>";

# Hi i'm a Unix shell-style comment
# Too bad you can't see me
echo "View the source of this file, you'll see no comments here <br>";
?>

Recent Comments

By: BrianNY Posted on 03-11-2009 1:20 PM

This is a brief but excellent review of PHP commenting.  I have tried several ways of making comments stand out and "separate" from the active code .. In looking at your multi-line example, I think that is where I will go in the future, whether the actual comment is one or more lines .. I can then indent the comment text, having it stand alone.

Thanks.

By: ianwilliam Posted on 08-24-2011 12:18 PM

Comment is a part of your PHP code that will not be translated by the PHP engine. You can use it to write documentation of your PHP script describing what the code should do. A comment can span only for one line or span multiple line.<a href="gedpracticetestsonlines.com/">ged practice test</a> <a href="gedpracticetestsonlines.com/ged-language-arts.htm">ged language arts practice test</a> <a href="gedpracticetestsonlines.com/ged-science.htm">ged science practice test</a> <a href="gedpracticetestsonlines.com/ged-prep-kit.htm">ged study guide</a> <a href="gedpracticetestsonlines.com/ged-social-studies.htm">ged social studies practice test</a>

By: fq0029 Posted on 10-04-2011 4:03 AM

bedspreads

Your site is good Actually, i have seen your post and That was very informative and very entertaining for me. Thanks for posting Really Such Things. I should recommend your site to my friends. Cheers.

Powered by Community Server (Non-Commercial Edition), by Telligent Systems