PHP Comments

PHP supports ‘C’, ‘C++’ and Perl style comments.
Generally comments are use for programmer to understand the code.
The comments are not printed in output.
comments are also used to hide any code.
PHP supports one-line and multi-line comments.

For example:

PHP one-line comment

A one-line comment is start with //.
Usually one-line comment can be use to the end of the line.
Means the immediate next line code will be printed.
They are generally used for short explanation or notes.

Output:

In PHP, we can comment multiple lines. These multiple lines comment need to be closed within /* */.
Multi-line comment are generally used to provide detailed explanations when necessary.

Output:

Ankit Wasankar

Senior Java Developer
Java 11 | Microservices | Reactjs | SQL

Help others by sharing the content!

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.