Good programmers write perfect code with plenty of comments.
- Comments are used to understand the code while reading.
- They can also be used to leave a part from the code.
- Comments are really important when trying to understand other's or your own code after years.
- Comments can explain what the code does.
- Comments does not need to follow language syntax rules.
PHP parser ignores all the comments.
There are two ways of commenting
- Single-Line Commenting - // your comment or # your comment
- Multi-Line Commenting - /* your comment */
PHP Comments Example
Run Example ››
<?php // this is a single-line comment # this is a single-line comment too /* This is a multi-line comment This line is a comment */ // to remove a part of code echo 5 /* + 2 */ + 5;