Comment (computer programming): Difference between revisions

Content deleted Content added
Nim: Use line/block consistently
use line instead of inline
Line 717:
 
====PHP====
Comments in [[PHP]] can be either incurly C++brace style (both inlineline and block), or useline hashesdelimited with <code>#</code>l. [[PHPDoc]]Blocks iscannot be nested. Starting in PHP 8, a style<code>#</code> adaptedonly frommeans Javadoccomment andif isit's anot commonimmediately standardfollowed forby documenting<code>[</code>. PHPOtherwise, it delimits an attribute, which continues till the next <code>]</code>. For example:
 
Starting in PHP 8, the # sign can only mean a comment if it's not immediately followed by '['. Otherwise, it will mean a function attribute, which runs until ']':
 
<syntaxhighlight lang="php">
/**
* This class contains a sample documentation.
*
* @author Unknown
*/
Line 730 ⟶ 727:
class MyAttribute {
const VALUE = 'value';
// ThisC++ isstyle an inlineline comment. It starts with '//', like in C++.
private $value;
# Thisscript is a Unix-style inlineline comment, which starts with '#'.
public function __construct($value = null) {
$this->value = $value;
}
/*
This is a multiline comment.
 
These comments cannot be nested.
*/
 
}
</syntaxhighlight>