As we continue our PHP series, we learn that we live and die by good or bad documentation. The practice of using comments in any project you do is crucial. Good comments are just as important as the program functioning correctly.
Below are a few examples of comments in PHP:
// This is a single-line comment # This is also a single-line comment /* This is a multiple-lines comment block that spans over multiple lines */ // You can also use comments to leave out parts of a code line
Commenting in PHP Video Tutorial
Example Project Code:
<html> <body> <h1>Comments in PHP</h1> <?php // This is a single line comment #This is a single line comment too /* One Two Three Go Multiple line comment */ #num = 12 + 3 /* * 6 + 4 */; echo $num; ?> </body> </html>