PHP Tutorial Example
Example
PHP Mail
PHP Libxml
PHP HTTP
PHP Filter
PHP Zip
PHP Directory
PHP Error
PHP SimpleXML
PHP Calendar
PHP Date
PHP Misc
PHP XML
PHP FTP
PHP Math
PHP MySQL
PHP Filesystem
PHP Array
PHP String
PHP Tutorial
PHP Introduction
PHP Installation
PHP Syntax
PHP Variables
PHP Echo
PHP Strings
PHP Operators
PHP Comments
PHP Include File
PHP Require
PHP If Statement
PHP If Else
PHP Elseif
PHP Switch
PHP Forms
PHP Functions
PHP Array
PHP While Loop
PHP For Loop
PHP For Each
PHP Do While
PHP POST and GET
PHP Magic Quotes
PHP htmlentities
PHP Files
PHP File
PHP File Create
PHP File Open
PHP File Close
PHP File Write
PHP File Read
PHP File Delete
PHP File Append
PHP File Truncate
PHP File Upload
PHP Strings
PHP strpos
PHP str replace
PHP substrreplace
PHP Capitalization
PHP explode
PHP implode
PHP Advanced
PHP Date
PHP Session
PHP Cookies
PHP Include
PHP Email
PHP Secure Email
PHP Error
PHP Exception
PHP Filter
PHP and AJAX
AJAX Intro
AJAX PHP
AJAX Database
AJAX XML
AJAX Live Search
AJAX RSS Reader
AJAX Poll
PHP XML
XML Expat Parser
XML DOM
XML SimpleXML
PHP Database
MySQL Introduction
MySQL Connect
MySQL Create
MySQL Insert
MySQL Select
MySQL Where
MySQL Order By
MySQL Update
MySQL Delete
PHP ODBC
PHP Misc
PHP connection aborted Function
Comments in PHP are similar to comments that are used in HTML. in html for client side design part. The PHP comment syntax always begins with a special character sequence and all text that appears between the start of the comment and the end will be ignored.
In HTML a comment's main purpose is to serve as a note to you, the web developer or to others who may view your website's source code. However, PHP's comments are different in that they will not be displayed to your visitors. The only way to view PHP comments is to open the PHP file for editing. This makes PHP comments only useful to PHP programmers.
In case you forgot what an HTML comment looked like, see our example below.
<!-- This is an HTML Comment -->
While there is only one type of comment in HTML, PHP has two types. The first type we will discuss is the single line comment. The single line comment tells the interpreter to ignore everything that occurs on that line to the right of the comment. To do a single line comment type "//" or "#" and all text to the right will be ignored by PHP interpreter.
<?php
echo "Hello Hiscript!"; // This will print out Hello Hiscript !
echo "<br />Help...You can't see my PHP comments!"; // echo "nothing";
// echo "My name is harryD!";
# echo "Its helpful for php programer";
?>
Notice that a couple of our echo statements were not evaluated because we commented them out with the single line comment. This type of line commenting is often used for quick notes about complex and confusing code or to temporarily remove a line of PHP code.
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
/* 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!";
*/
?>
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. Good programming skill using comment part. 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 PHP in the future. Use single line comments for quick notes about a tricky part in your code and use multiple line comments, its easy to understand the developer part, when you need to describe something in greater depth than a simple note.

