PHP Questions Home

Categories

Arrays
Files
Forms
Functions
Images
MySQL
Numbers
Others
Strings
Website


PHP Functions

PHP Functions


More PHP

Top Questions
Ask a Question

How do I add comments to my PHP script?


If you want to add comments, there are various options for you.

For single line comments, the most common method is the double slash, like this:
<?php
//this is a comment
?>


For multi-line comments you can either use the above method, but it's easier to do this:
/*
This is a comment that spans several lines
This brilliant code was written by me
Use comments throughout your scripts so you can remember what on earth they do when you come back to it six months later
Or if another programmer has to support your code, then give them a chance by filling it with copious comments, it's good practice
*/
?>



More other PHP Questions

How do you get an array of the date and time?
I have lots of if else logic - is there another option?
How do I find out about my PHP installation?
Can I include Javascript in my PHP code?
Can PHP create PDF files for me?