Advertisement

Google Ad Slot: content-top

PHP Comments

~1 min read · PHP
On this page

Comments in PHP


PHP comments can be used to describe any line of code so that other developer can understand the code easily. It can also be used to hide any code. Comments in PHP are lines of code ignored by the PHP engine during execution.


Types of PHP Comments

1. Single-Line Comments


Single-line comments are used to comment out one line or part of a line of code. There are two ways to create single-line comments:

Using // (C++ style single line comment)
Try it yourself
Using # (Unix Shell style single line comment)
Try it yourself

2. Multi-Line Comments


Multi-line comments are used to comment out multiple lines of code. They start with /* and end with */.

Example
Try it yourself