34,333
edits
Changes
no edit summary
Another useful application of multi-line comments is to comment out blocks of PHP code temporarily. It is quite commomn to have written some PHP script and then wonder if you can re-write it so that it is perhaps more efficient or reliable. In this situation you can comment out the old script fragment so that it is no longer executed and write some new code. If it turns out your new code is worse than the original (which happens from time to time) you can simply remove the new code and uncomment the old to bring it back into the execution flow.
== Summary ==
The objectives of this chapter were to hopefully raise your awareness of the importance of commenting your PHP code and also to provide an overview of how to use the commenting mechanism provided by PHP. Both single and multi-line comments can easily be added to PHP code using the approrpiate markers. Try to get into the habit of commenting your code as you write. Both you and those who have to maintain your code in the future will be glad you did.