Msg#: 4605126 posted 12:22 pm on Aug 27, 2013 (gmt 0)
I am working on collaboratively developed code run on lots of different websites and script environments.
Inline comments throughout these scripts provide guidance to the various developers, and creating in house rules to consistently write these comments was proposed.
# New line hashtag comments are an introduction for following code #! New line shebangs comments highlight issues with or ways the script could be improved
While PHP supports inline comments that start with a hashtag and ignore everything thereafter on the same line, I'm concerned that hashtags immediately followed by the exclamation mark (shebangs) might be an exception to this as some older scripts seem to specify PHP scripting paths proceed by shebangs.
As the code is run in different environments it is difficult to know if these types of comments might provide unforeseen errors and I was hoping somebody might be more familiar with PHP and shebangs.
Msg#: 4605126 posted 11:09 pm on Aug 27, 2013 (gmt 0)
#! as the first line in a script on a unix (or unix-like) machine should indeed point to the command processor for the script itself. Shell scripts use this to specify the shell of choice (e.g. #!/bin/sh ) It's rather uncommon to use it for php, but the shell will execute any executable text file with the specified command processor if it can.
I'd avoid the notation if you hope it's a comment n the mind of the reader.
As jatar_k said: use // ... and /* ... */ everybody will get it.