PHP and autoloading · Question 8 of 12

Which character sequence starts a DocBlock comment in PHP?

1 answer is correct. Easy

Show answer

Answer

  • A /**

Explanation

A DocBlock starts with /** (a slash and two asterisks) and ends with */, for example /** @var list<Item> */. Only this second asterisk tells IDEs, phpDocumentor and PHPStan that the comment contains documentation and tags such as @param or @return. A normal block comment with /* looks almost the same, but these tools do not treat it as a DocBlock. // and # start single-line comments; #[, however, has marked the beginning of an attribute since PHP 8.

Certifications & exams

Which exam comes next?

You can already practise for 19 exams, and 21 are up for a vote. See all certifications with their official information, cast your vote or suggest your exam.

See all certifications