Comment Out PHP

Written by admin

Topics: PHP Scripting

Comments are an important part of any programming language and PHP is no exception. Comments are used to document code (for yourself and/or others) and to comment out php as needed. PHP provides two forms of inline comments and one form for multiline comments.

PHP Comment Types by Example:

<?php
echo "There are comments below but you won't see them.";
// A double forward slash comments out just this line.
# A single pound sign comments out just this line.

echo "and how about a multi-line comment?";
/*
Here is how
you can 
comment out php
on several lines
*/
?>

The above code fragment when interpreted would display:

There are comments below but you won't see them.
and how about a multi-line comment?

Well that’s about all there is to know about comments.

Back to Learn PHP in 24 Hours for more fun :-)

type=pings Trackbacks For This Post

  1. Lesson 2: Comments and Variables - Learn php in 24 hours

Leave a Comment Here's Your Chance to Be Heard!