PHP SOLUTIONS: DYNAMIC WEB DESIGN MADE EASY When (Web design templates)

PHP SOLUTIONS: DYNAMIC WEB DESIGN MADE EASY When a script is fresh in your mind, it may seem unnecessary to insert anything that isn t going to be processed. However, if you need to revise the script several months later, you ll find comments much easier to read than trying to follow the code on its own. During testing, it s often useful to prevent a line of code, or even a whole section, from running. Because PHP ignores anything marked as a comment, this is a useful way of turning code on and off. There are three ways of adding comments: two for single-line comments and one for comments that stretch over several lines. Single-line comments The most common method of adding a single-line comment is to precede it with two forward slashes, like this: // this is a comment and will be ignored by the PHP engine PHP ignores everything from the double slashes to the end of the line, so you can also place comments alongside code (but only to the right): $startYear = 2006; // this is a valid comment Instead of two slashes, you can use the hash or pound sign (#). Because # stands out prominently when several are used together, this style of commenting is used mainly to indicate sections of a longer script, like this: ################## ## Menu section ## ################## Multiline comments If you want a comment to stretch over several lines, you can use the same style of comments as in Cascading Style Sheets (CSS). Anything between /* and */ is treated as a comment, no matter how many lines are used, like this: /* This is a comment that stretches over several lines. It uses the same beginning and end markers as in CSS. */ Multiline comments are particularly useful when testing or troubleshooting, as they can be used to disable long sections of script without the need to delete them. A combination of good comments and well-chosen variable names makes code easier to understand and maintain.
Check Tomcat Web Hosting services for best quality webspace to host your web application.

Leave a Reply