PHP 7 Comment

The comment is a developer guideline. This is not visible on the web page. It exists only for the human reader. The purpose of comment is only to know in the future what you did, or guideline for future modifications. Comments are invaluable in helping the next person who reads your code figure out what you were thinking when you wrote it, even when that person is yourself a month from now.
It is good practice to write comments for every function, class, property in your code.

PHP 7 Comments styles -

Single line Comment -

PHP supports single line comment same style as in C++ and Shell.

C++ Style

// This is C++ style one line comment supported in PHP.


SHELL Style

# This is Shell style one line comment supported in PHP.


Multiple Line Comment -

PHP supports multiple line comment in C style.

C Style Comment

/* This is C style
* Comment
* Supported in PHP
*/

We can also write multiple line comment like this -
/* This is a
multiple line
comment supported
in PHP
*/








Read more articles


General Knowledge



Learn Popular Language