📡 You're offline — showing cached content
New version available!
Quick Access
Tutorials PHP for Beginners Comments in PHP

Comments in PHP

3 min read
Comments are notes in your code that PHP ignores when running. Use // for single-line and /* */ for multi-line comments. Good comments explain why the code was written a certain way, not just what it does.

Comments in PHP

Comments are lines ignored by the PHP interpreter — useful for notes and disabling code.

// Single-line comment

# Also single-line (shell style)

/*
   Multi-line comment
   spans many lines
*/

/**
 * DocBlock comment
 * Used by IDEs and documentation generators
 * @param string $name
 * @return string
 */