Formatting Your Comments
There are two kinds of comments that can be used to hide text in a PHP file, and each has its own formatting method:
- single-line comments
- multiple-line comments
Single-line comments, suitable for short comments, are indicated by either a pound sign or two forward slashes before the comment. For example:
// Project: Super duper WordPress plugin
# Author: Jane Doe
Each of the above is a single-line comment and will remain hidden in your PHP file.
Multiple-line comments are longer annotations, and have formatting at the beginning and the end. At the beginning it's a forward slash followed by an asterisk, and at the end it's an asterisk followed by a slash. For example:
Project: Super duper WordPress plugin
Author: Jane Doe
We've taken the same single-line comments from above and turned them into one multiple-line comment. It's personal preference which method you choose to use and when.
This concludes the short and, we hope, informative lesson on how to hide text in PHP file. In a PHP file, rather. Happy coding and remember: comment early and comment often.
Image Credits: Screenshots ©2010 Jacob Carson.