![]() |
Start comments in PHP: /* or /**
My PHP IDE does not seem to recognize /** as the beginning of PHP comments. It does recognize /* as the beginning, however.
When I see other's code, I often see /** used to begin PHP comments. Question: Is the /* comment */ method pretty much accepted everywhere? Thanks, Dave |
I think /** is what PHPDoc looks for before it parses comments.
What is your IDE just out of interest, it sounds like there syntax matching algo is incorrect. |
In Java, Javadoc (the equivalent of PHPdoc) uses
/** */ comments for Javadoc comments and /* */ for plain comments.I tend to use a /** */ when doing a multiline comment, a /* */ on an line comment detailing a section of code and a // when detailing the next few lines.For example: PHP Code:
|
That is interesting. I use gedit for Linux and it recognizes anything starting with /* as a comment. Thus /***** counts as a comment, and *****/ counts as a closing comment.
|
What IDE do you use? Because PHP should ignore anything between the "/*" and "*/" tags regardless of what they are.
|
Here is an example:
/** * Applies the main template to the page * * @param string $file * @param bool $first */ If the PHP parser spots /** it starts reading the whole comment block for later (possible) usage. So /** is not just for yourself, but it's actually used in parsetime (i will explain later). When using /* it will be just ignored. The good thing about /** is for combinating /** information with the Reflection API, you can creating your own doc system. Also very nice is using it in Zend Studio. When you are working on some others code, some sort of API. You can see much information about a function without looking in the code of the API writher, because ZS shows you the information from /** when starting the function. You have to check it out to be convinced :) |
This is a PHPDoc block comment, therefore its for the PHPDoc parser not PHP parser itself and as VI correctly said:
Quote:
The double '*' is there for the PHPDoc parser, as far as i know. |
That is interesting, and clears up the /* vs. /** "issue" up for me very well. Thank you!
Dave |
Additional to my first post, it might be intressting to note that you can actually read the /** comments on runtime in PHP yourself :)
|
I used # or ## myself. Works just as good.
|
I dont use '#' because it looks like the she-bang line when running PHP on the CLI:
shell Code:
|
Quote:
|
Quote:
|
PERL style comments should be terminated, just like asp_tags =P
|
asp itself should be terminated. All hail php and that #
|
Retro can is an work in nike free run shoes genre and music, and also cricket it only translates to the worst numbers through a score-sheet. At the lower part of the Mack Bridge Test, India's digits were dire: 0-2 inside of a four-Test series, is better than by 196 this kind of 319 runs, and get totals of 285, 261, 288 and 158 so far. This was no way the India for their perpetual scrap, advantages bouncebackability quotient, the no. 1 Test review (in that precise order through significance). On what develop into the nike free run 3 final afternoon linked with an Test, as the wickets column on line giant scoreboard eventually left of the pavilion ticked in place ominously, Sachin Tendulkar, emerges for 56, could have been playing in an increased grim 1990s. At one end of the pitch was regular posting intent of top quality. At the all, a revolving door.
|
| All times are GMT. The time now is 09:55 PM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0