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 "Hi";

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

# This is also a single-line comment. THis line is also ingnored 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

If you want to learn more about Web Development, feel free to follow me on Youtube!

Top comments (0)