TUTORIALS » PHP / MySQL » PHP essentials (guided tutorials)Comments in PHP
When you write a PHP script, you can include text comments that will be ignored by the PHP parser.
Here are a few good reasons to include comments in your PHP scripts:
Single line commentsTo write a single-lined comment, just start it with two forward slashes.Example: <?php // This is a comment, it will be ignored by the PHP parser echo 'Hello world'; // I would love to change the world, but they won't give me the source code ?> Multiple line commentsYou can also write multi-line comments by enclosing them between /* and */.Example: <?php /* This is a multi-line comment. It will be ignored by the PHP parser. Regards to you all! */ echo 'Hello world'; ?> Remember, the PHP parser ignores the comments; thus they are not sent to the client's browser. Now follow through our next tutorial – Variables in PHP.
|
|