Search:

Home | Programming | Php


How to Comment your PHP Code

By: Deceth

Commenting your code is extremely important no matter which programming language you are using. Not only so others will be able to understand what you are doing, but so you yourself will be able to figure it out again quickly should you not look at your code for several months.

In PHP there are three ways you can comment your code:


<?php
// This is a single line comment!
?>



<?php
// # This is a single line comment as well!
?>



<?php
/* This method is used for commenting
larger blocks of text within the code.
Everything between the start and end
comment symbols will be a comment.
This whole paragraph is therefore a
comment.
*/
?>


Don't fall into the bad habit of not commenting your code. While it may sometimes seem like a hassle and waste of time, you will actually find quit the opposite later on down the road. You will save time by being able to quickly re-use existing code and you will save co-workers and friends lots of frustration if you are working on a group project which may result in them buying you a nice coffee early in the morning from time to time! :)

Article Source: http://www.writerdatabase.com

www.webdevnotes.com/how-to-comment-your-php-code/

Please Rate this Article

 

Not yet Rated

Click the XML Icon Above to Receive PHP Articles Via RSS!

Powered by Article Dashboard