|
As with any programming language, it is quite important to comment in your script. If you are working on a script with someone else you must let them know what you code does and if you are distributing your script you will need to show people how to edit it. Even if you are the only one who will use your script it is useful to comment so that you can edit it at a later date. In PHP there are two ways you can comment. One way is used for single line comments and the other is used mainly for comments that go over one line. A single line comment is written as follows: // Your comment can go in here Everything after the // will be ingnored when the script is executed. You can even place these on the end of another line e.g. print "Hello $name"; // Welcome to the user Another way of commenting is by using multi-line comments: /* The following piece of code will take the input the user gave and will check that it is valid before adding it to the database */ Anything between the /* and the */ will be ignored. It is important that you always close this type of comment as not doing so could make your script not work. Credits: www.freewebmasterhelp.com
|