homepage Welcome to WebmasterWorld Guest from 54.227.141.230
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe to WebmasterWorld
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
Shebang problems with some PHP environments
ocon




msg:4605128
 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.

Under consideration:
# 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.

 

jatar_k




msg:4605213
 4:42 pm on Aug 27, 2013 (gmt 0)

why not use slashes for inline and block?

//

/*
*
*/

and maybe TODO: which is supported by most editors to show possible improvements

hash commenting seems archaic and, as you say, open to interpretation

swa66




msg:4605285
 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.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved