PHP Comment Syntax: Multiple Line Comment

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

PHP Comment Syntax: Multiple Line Comment

Similiar to the HTML comment, the multi-line PHP comment can be used to comment out large blocks of
code or writing multiple line comments. The multiple line PHP comment begins with " /* " and ends with " */ ".

PHP Code:
<?php
/* This Echo statement will print out my message to the
the place in which I reside on. In other words, the World. */
echo "Hello World!";
/* echo "My name is Humperdinkle!";
echo "No way! My name is Uber PHP Programmer!";
*/
?>

Display:
Hello World!

Good Commenting Practices

One of the best commenting practices that I can recommend to new PHP programmers is....USE THEM!!
So many people write complex PHP code and are either too lazy to write good comments or believe the
commenting is not needed. However, do you really believe that you will remember exactly what you were
thinking when looking at this code a year or more down the road?
Let the comments permeate your code and you will be a happier PHPer in the future. Use single line
comments for quick notes about a tricky part in your code and use multiple line comments when you need to
describe something in greater depth than a simple note.

You might also like