29th Dec 2008
Effective Use Of PHP Comments In Web Development
PHP is a very versatile language, allowing for programmers to make applications according to their various tastes or styles. But one thing all programmers should maintain is the ability to comment effectively. In essence, commenting can save hours of time perusing code months down the road- and is often required by employers.
PHP comments may only be seen by developers, since the PHP engine doesn’t pay attention to remarks declared as comments. This is quite handy for developers, who can make visible notes on their source code all while the visitor to the webpage is kept in the dark about any such comments.
Unlike HTML comments, PHP comments aren’t even visible in the source code of a website. HTML comments are visible to the general public, which can potentially lead to the stealing of code or may even help hackers exploit applications. PHP comments aren’t output to the browser at all, so they are completely safe from prying eyes.
When we wish to tell the PHP engine that we want to make use of a comment, we have three different structures to select from. The first two are “#” and “//” and are considered to be single line comment structures. For commenting on multiple lines, we use “/*” and “*/” in that order. Multiple line comments can be created through multiple single line comment calls, but this is of course redundant.
Unbeknown to most, PHP comments can also be used for more practical scenarios, such as troubleshooting. Expert programmers will find they have a problem with their application, and comment out different blocks of code to see what is causing the error. While it is usually in new code blocks, this method will indeed show that sometimes the problem is due to program code interacting wrong, which can in effect mean the problem is anywhere in the application.
Commenting in PHP is also great to use in selection structures, since PHP has long been known as a hard to scale language. Once files start getting big, it can be dizzying to try and remember which loops and selection structures go where, and what they do. By commenting out every closing bracket, and what it is in relation to, the problem is easily fixed. This is often mandatory for programmers who work for employers.
In Conclusion
In the end, there is a lot to gain from using PHP comments. They are quite functional for saving time, and also serve their purpose in troubleshooting. For more information on the idea of using comments effectively, check out local bookstores and online resources for more material.
Learn more about php comment syntax and php comment line.
PHP is a very versatile language, allowing for programmers to make applications according to their various tastes or styles. But one thing all programmers should maintain is the ability to comment effectively. In essence, commenting can save hours of time perusing code months down the road- and is often required by employers.
PHP comments may only be seen by developers, since the PHP engine doesn’t pay attention to remarks declared as comments. This is quite handy for developers, who can make visible notes on their source code all while the visitor to the webpage is kept in the dark about any such comments.
Unlike HTML comments, PHP comments aren’t even visible in the source code of a website. HTML comments are visible to the general public, which can potentially lead to the stealing of code or may even help hackers exploit applications. PHP comments aren’t output to the browser at all, so they are completely safe from prying eyes.
When we wish to tell the PHP engine that we want to make use of a comment, we have three different structures to select from. The first two are “#” and “//” and are considered to be single line comment structures. For commenting on multiple lines, we use “/*” and “*/” in that order. Multiple line comments can be created through multiple single line comment calls, but this is of course redundant.
Unbeknown to most, PHP comments can also be used for more practical scenarios, such as troubleshooting. Expert programmers will find they have a problem with their application, and comment out different blocks of code to see what is causing the error. While it is usually in new code blocks, this method will indeed show that sometimes the problem is due to program code interacting wrong, which can in effect mean the problem is anywhere in the application.
Commenting in PHP is also great to use in selection structures, since PHP has long been known as a hard to scale language. Once files start getting big, it can be dizzying to try and remember which loops and selection structures go where, and what they do. By commenting out every closing bracket, and what it is in relation to, the problem is easily fixed. This is often mandatory for programmers who work for employers.
In Conclusion
In the end, there is a lot to gain from using PHP comments. They are quite functional for saving time, and also serve their purpose in troubleshooting. For more information on the idea of using comments effectively, check out local bookstores and online resources for more material.
Learn more about php comment syntax and php comment line.
Posted in Computers, General, Reference And Education, Technology | No Comments »