Begin Web Programming with PHP & MySQL

Advertisements



PHP Comments

PHP comments are used to describe the code. PHP provides a way to comment inside the code which will not be executed by the program.

  • Comment clarifies quickly the purpose of a file or code block.
  • Comments will help you while editing the code at a later time.
Single Line Comment

Use // or # at the beginning of a line.
Eg:
<?php
// This is a single-line comment
# This is also a single-line comment
?>

Multi Line Comment

Place your plain text inside /* */. It is a multi-line comment.
Eg:
<?php
/*
This is a multiple line comment.
Any number of
lines can be included here.
*/
?>