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)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Found this article valuable? Consider leaving a ❤️ or sharing your thoughts!

Got it!