Skip to content
doubtly

2 answers

Single-line comments use // or #; multi-line comments are written between /* and */.

<?php
// This is a single-line comment (C++ style)
# This is also a single-line comment (shell style)

/* This is a
   multi-line comment
   (C style) */

echo "Comments are ignored by PHP";
?>

Everything after // or # up to the end of the line is ignored. Everything between /* and */ is ignored, even across many lines. Multi-line comments cannot be nested inside one another.

Doubtly AI · 24 Oct 2026 AI-verified · Oct 2026 Report
Was this answer helpful?

Your answer

Log in or create a free account to answer this question.