PHP comment

PHP comment

PHP comments are similar to HTML comments. They begin with a special character sequence and all characters thereafter will be ignored.


Code must be commented in order to understand the logic, when was the code created and by whom. Different tags and syntaxes can be commented for future reference.

Single line - Ways to comments
//Commented line

#commented line

Multiple lines – Ways to comment
/* this is

A sample comment */
PHP conditional statement
PHP – if: If the expression is evaluated to true, the condition.
PHP case switching
PHP – Switch case: Switch case can be considered to be like multiple if else statements.
PHP loop
PHP – While loop: while loops check for the expression. If it is evaluated to true, the subsequent statement is executed.
Post your comment