DEV Community

Cover image for PHP Comments
Christopher Glikpo  ⭐
Christopher Glikpo ⭐

Posted on

PHP Comments

Comments are text within code that won’t be executed when the program is run.

Comments can be useful for explaining how code is working and leaving notes for other developers. PHP supports both single line comments and multi-line comments.

For single line comments, the syntax is // or #. Anything after these symbols on a line is ignored by the PHP interpreter.

For multi-line comments, anything between /* and */ is ignored by the interpreter.

echo "Hello";

// This is a single-line comment. This line is ignored by PHP.

# This is also a single-line comment. This line is also ignored by PHP.

/* This is a multi-line comment.
   everything in between these two comment 
   delimiters is ignored by PHP. */

Enter fullscreen mode Exit fullscreen mode

Connect me on facebook and LinkedIn

Top comments (0)