We arrive at the cornerstone of all languages, including PHP, comments. I cannot stress the importance of commenting your code. As a webmaster, I create all kinds of web applications, but more importantly, I maintain the code previously crafted before I arrived. So many times, I have wondered “what the heck were they doing here?”…And after about 10-20 minutes of digesting their code, do I truly understand what they were trying to accomplish. Please comment. Please. With that being said, try to not over comment either. It is fine to do it on every few lines starting out as a beginner. However, when you get more advanced, try to comment large sections (each function and at least every 30 lines) and explain what you are doing in the following code.
Enough of the lecturing, how do I actually comment? Commenting is super easy just like in other languages. In PHP, you can make comments in two ways.
Comment Out One Line
Obviously, the // only comments until semicolon or until the end of the line. It does not require a closing partner. The # works exactly the same way as the previous comment. The other type of comment, is a block comment, which allows you to comment out more than one stupid line. It lets you comment out however much you want.
The Multiline Comment
The /* requires the closing tag of */. Everything in between these tags is completely ignored as PHP code. This comment is perfect for testing your code, blocking out code that is not needed right now, and writing a paragraph on what your following code is supposed to do.