1. Home
  2. Computing & Technology
  3. PHP / MySQL

Learn PHP - A Beginner's Guide to PHP Programing

By Angela Bradley, About.com

2 of 9

Comments

If you want something to be ignored (a comment for example) you can put // before it as I did in our example on the previous page. There are a few other ways of creating comments within PHP, which I will demonstrate below:

<?php

//A comment on a single line

#Another single line comment

/*
Using this method
you can create a larger block of text
and it will all be commented out
*/

?>

One reason you may want to put a comment in your code is to make a note to yourself about what the code is doing for reference when you edit it later. You may also want to put comments in your code if you plan on sharing it with others and want them to understand what it does, or to include your name and terms of use within the script.

Explore PHP / MySQL
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. PHP / MySQL
  4. Learn PHP
  5. Learn PHP - PHP Tutorial - PHP Comments

©2009 About.com, a part of The New York Times Company.

All rights reserved.