Comments in PHP

PHP supports single line and multi line comments. PHP comments are similar to C/C++ and Perl style (Unix shell style) comments.

PHP Single Line Comments

There are two ways to use single line comments in PHP.

  • // ( single line comment)
  • # ( single line comment)

// this is C++ style single line comment
# this is Unix Shell style single line comment
echo “Welcome to PHP single line comments”;

PHP Multi Line Comments

In PHP, we can comments multiple lines also. To do so, we need to enclose all lines within /* Comments */. Let’s see a simple example of PHP multiple line comment.

/* Anything placed within comment will not be displayed on the browser; */
echo “Welcome to PHP multi line comment”;

Leave a Reply