Skip to content
Justice Tech School

PHP Comments

PHP supports // and # for one line and /* */ for several lines. PHPDoc blocks starting with /** describe functions for editors.

Example
echo "start\n";
// one line
# also one line
/* several
   lines */
/** Adds numbers.
 * @param int $a */
function add($a, $b) { return $a + $b; }
echo add(1, 2), "\n";

Result

start
3

Exercise

Start a one line comment.

 note

Quiz Test

Which is NOT a PHP comment style?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.