...
There are three types of comments that may be used in PHP. They are block comments (/* */), inline comments (//), and shell comments (#).
Block comments are used for doc commenting, commenting out large sections of code. Blesta uses PHPDoc syntax for all doc comments. Block comments may not be used as a substitute for inline comments.
Warning |
---|
|
Code Block |
---|
| /*
This is a comment.
*/
if ($foo > $bar) {
return $bar
} |
|
Tip |
---|
|
Code Block |
---|
| /**
* This is a DocBlock comment
*/
function foo() {
} |
|
Inline comments should be used to clarify code. You are discouraged from using inline comments at the end of a line as this creates run-on lines and your comment is unlikely to be read.
Warning |
---|
|
Code Block |
---|
| /*
Calculate the circumference
*/
$c = 2*pi()*$r; |
|
Note |
---|
title | Correct, but discouraged |
---|
|
Code Block |
---|
| $c = 2*pi()*$r; // Calculate the circumference |
|
Tip |
---|
|
Code Block |
---|
| // Calculate the circumference
$c = 2*pi()*$r; |
|
...
These comments should only be used to identify TODO comments.
...