Comments are ignored by PHP. Use them to explain why code does something — the what is usually obvious from the code itself.
PHP
<?php
// Single-line comment
# Also a single-line comment (less common)
/*
Multi-line comment.
Useful for longer notes.
*/
$total = $price * 1.13; // 13% VAT in NepalDoc comments
A /** ... */ block immediately before a function or class is a
docblock. Editors read these for autocomplete and type hints.
PHP
<?php
/**
* Calculate the total price including VAT.
*
* @param float $price Base price in NPR
* @return float Price with 13% VAT applied
*/
function withVat(float $price): float
{
return $price * 1.13;
}Commenting out code
Wrapping code in a comment temporarily disables it — handy while debugging, but delete dead code before committing it rather than leaving it commented out forever.
PHP
<?php
// echo $debugValue;
echo $realValue;