PHP Comments

In this chapter you will learn:

  1. What is a comment
  2. Syntax to mark comments
  3. Note for comments

Description

In programming a comment is the description for our code.

Syntax

There are three ways to create comments in PHP:

  • //
  • /* */, and
  • #.

Note

// and # mean "Ignore the rest of this line,"


     <?php// j a  v a 2 s .c o  m
             print "This is printed\n";
             // print "This is not printed\n";
             # print "This is not printed\n";
             print "This is printed\n";
      ?>
      

The code above generates the following result.

/* means "Ignore everything until you see */."


     <?php/* ja v  a 2 s .  co  m*/
             print "This is printed\n";
             /* print "This is not printed\n";
             print "This is not printed\n"; */
      ?>

The code above generates the following result.

Next chapter...

What you will learn in the next chapter:

  1. What is an if statement
  2. Syntax for if statement
  3. Note for if statement
  4. Example - if statement
  5. Example - if statement with more conditions
Home » PHP Tutorial » PHP Statements
PHP Code Blocks
PHP Comments
PHP if
PHP if else
PHP switch
PHP foreach
PHP while loop
PHP do while loop
PHP for loop
PHP break
PHP continue
PHP Mixed-Mode Processing
PHP include/require