C-language comment style has become an industry standard. There's nothing wrong with using #
comments at all unless the particular coding standard for your project or workplace prohibits it. Standards are the key to yielding readable code.
In many cases, //
and/or /* */
are considered standard comment syntax for programming languages. The only exception that commonly is encountered is VB, which uses '
. In contrast, #
is often considered the standard comment syntax for shell scripting.
PHP was designed to perform both tasks originally. PHP can and does function reasonably well as a shell scripting language and can be invoked from the command line. It has functions to handle reading from stdin and writing to stdout. This is probably the origin of the #
syntax for comments. #
is probably discouraged because PHP is thought of as a programming language nowadays, rather than a tool for shell scripting. Specifically, the style guides that the question references are for web apps, rather than some shell tool.