PHP Comments

From Tutorial
Jump to: navigation, search

Using comments in PHP

Comments are used to increase the readability of the program. While executing the script, comments are ignored by the php interpreter.In PHP comments are of classified in to

Single line comments start with two slashes( // ). Single line comments start with hash symbol( # ). Multi line comments between /* and */.

The following example demonstrate different types of comments in php

<?php
echo "This page demonstrates various comments in php";
//This is a single line comment like in javascript .

#This is also a single line comment 

/*This is a
	multi line
		comment */
?>

The PHP Extension and Application Repository (PEAR), provides a large collection of libraries and scripts for extending the functionalities of php, may discourage the single line comments with # symbol.

Personal tools