• Have Any Question?
  • contact@eitworld.com

PHP Comments





  • Comments are those statements which can not be displayed by the browser, but they give the information about your PHP script.
  • There are two type of comments in PHP:
    • Single Line Comment
    • Multiple Line Comment

Single Line Comment

  • The single line comment starts with the “//” or “#”. PHP interpreter ignores everything that occurs on that line to the right of the symbol “//” or “#”.
  • Here is the syntax of single line comment in PHP:

Syntax

//This is single line comment;

Example


<!DOCTYPE html>
<html>
<body>
<?php
echo "eitworld.com"; // This statement will print eitworld.com
?>
</body>
</html>

Output

In the above example statement echo “eitworld.com”; will print eitworld.com on the screen and the statement // This statement will print eitworld.com is a single line comment which will be ignored by the PHP- interpreter.

Multiple Line Comment

  • Multiple line comment starts with “/*” and ends with ” */ “. Multi-line PHP comment is used to comment out large blocks of codes.

Syntax

/*This is
multiple line
comment;*/

Example


<!DOCTYPE html>
<html>
<body>
<?php
echo "eitworld.com"; /* This statement will
print
eitworld.com*/
?>
</body>
</html>

Output

#9632; In the above example statement echo “eitworld.com”; will print eitworld.com on the screen and the statement /* This statement will
print
eitworld.com*/
is a multi line comment which will be ignored by the PHP- interpreter.



Real Time Web Analytics