 |
Account Login
|
 |
 |
Latest Articles
|
 |
 |
IRC Channel
|
 |
 |
Associates
|
 |
 |
Associates
|
 |
|
 |
 |
|
 |
09-03-2008, 10:07 AM
|
#1 (permalink)
|
|
The Acquainted
Join Date: Apr 2008
Posts: 110
Thanks: 97
|
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
|
|
|
|
09-03-2008, 10:51 AM
|
#2 (permalink)
|
|
The Prestige
Join Date: Oct 2007
Location: Manchester, UK
Posts: 854
Thanks: 32
|
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.
__________________
mysql> SELECT * FROM `users` WHERE `users`.`clue` > 0;
Empty set (0.00 sec)
|
|
|
|
|
The Following User Says Thank You to sketchMedia For This Useful Post:
|
|
09-03-2008, 12:19 PM
|
#3 (permalink)
|
|
The Contributor
Join Date: Jan 2008
Location: England, UK
Posts: 83
Thanks: 3
|
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:
/** * Page-level docblock */
/* Editing the file */
// Open, write and close $f = fopen('file.html', 'w'); fwrite($f, 'tets'); fclose($f);
|
|
|
|
|
The Following User Says Thank You to Ross For This Useful Post:
|
|
09-04-2008, 12:36 PM
|
#4 (permalink)
|
|
The Wanderer
Join Date: Sep 2008
Posts: 6
Thanks: 1
|
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.
|
|
|
|
|
The Following User Says Thank You to zspencer For This Useful Post:
|
|
09-04-2008, 07:23 PM
|
#5 (permalink)
|
|
Wizard
Join Date: Sep 2007
Posts: 1,299
Thanks: 17
|
What IDE do you use? Because PHP should ignore anything between the "/*" and "*/" tags regardless of what they are.
|
|
|
|
|
The Following User Says Thank You to Village Idiot For This Useful Post:
|
|
09-04-2008, 08:14 PM
|
#6 (permalink)
|
|
The Addict
Join Date: Nov 2007
Location: the Netherlands
Posts: 281
Thanks: 2
|
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 :)
__________________
Nunchaku! Who doesn't like martial arts? =)
|
|
|
|
The Following 2 Users Say Thank You to Jim For This Useful Post:
|
|
09-04-2008, 08:31 PM
|
#7 (permalink)
|
|
The Prestige
Join Date: Oct 2007
Location: Manchester, UK
Posts: 854
Thanks: 32
|
This is a PHPDoc block comment, therefore its for the PHPDoc parser not PHP parser itself and as VI correctly said:
Quote:
|
PHP should ignore anything between the "/*" and "*/" tags regardless of what they are.
|
Im guessing that Zend Studio (and indeed eclipse) reads PHPDoc comments and uses them to provide more comprehensive code completion hints.
The double '*' is there for the PHPDoc parser, as far as i know.
__________________
mysql> SELECT * FROM `users` WHERE `users`.`clue` > 0;
Empty set (0.00 sec)
|
|
|
|
|
The Following 2 Users Say Thank You to sketchMedia For This Useful Post:
|
|
09-07-2008, 12:40 PM
|
#8 (permalink)
|
|
The Acquainted
Join Date: Apr 2008
Posts: 110
Thanks: 97
|
That is interesting, and clears up the /* vs. /** "issue" up for me very well. Thank you!
Dave
|
|
|
|
|
The Following User Says Thank You to Dave For This Useful Post:
|
|
09-08-2008, 07:58 PM
|
#9 (permalink)
|
|
The Addict
Join Date: Nov 2007
Location: the Netherlands
Posts: 281
Thanks: 2
|
Additional to my first post, it might be intressting to note that you can actually read the /** comments on runtime in PHP yourself :)
__________________
Nunchaku! Who doesn't like martial arts? =)
|
|
|
09-09-2008, 08:46 AM
|
#10 (permalink)
|
|
The Wanderer
Join Date: Mar 2008
Location: United Kingdom
Posts: 22
Thanks: 1
|
I used # or ## myself. Works just as good.
|
|
|
09-09-2008, 06:39 PM
|
#11 (permalink)
|
|
The Prestige
Join Date: Oct 2007
Location: Manchester, UK
Posts: 854
Thanks: 32
|
I dont use '#' because it looks like the she-bang line when running PHP on the CLI:
__________________
mysql> SELECT * FROM `users` WHERE `users`.`clue` > 0;
Empty set (0.00 sec)
|
|
|
|
09-09-2008, 06:59 PM
|
#12 (permalink)
|
|
The Contributor
Join Date: Jan 2008
Location: England, UK
Posts: 83
Thanks: 3
|
Quote:
Originally Posted by sketchMedia
I dont use '#' because it looks like the she-bang line when running PHP on the CLI:
|
I don't use hash because it just looks ugly to me 
|
|
|
|
|
The Following User Says Thank You to Ross For This Useful Post:
|
|
09-10-2008, 10:38 AM
|
#13 (permalink)
|
|
The Prestige
Join Date: Oct 2007
Location: Manchester, UK
Posts: 854
Thanks: 32
|
Quote:
Originally Posted by redSHIFT
I don't use hash because it just looks ugly to me 
|
That too 
__________________
mysql> SELECT * FROM `users` WHERE `users`.`clue` > 0;
Empty set (0.00 sec)
|
|
|
|
09-11-2008, 07:53 AM
|
#14 (permalink)
|
|
The Frequenter
Join Date: Sep 2007
Location: Denmark
Posts: 352
Thanks: 8
|
PERL style comments should be terminated, just like asp_tags =P
__________________
|
|
|
09-11-2008, 09:34 AM
|
#15 (permalink)
|
|
The Wanderer
Join Date: Mar 2008
Location: United Kingdom
Posts: 22
Thanks: 1
|
asp itself should be terminated. All hail php and that #
|
|
|
03-30-2013, 07:55 AM
|
#16 (permalink)
|
|
The Acquainted
Join Date: Mar 2013
Posts: 131
Thanks: 1
|
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.
|
|
|
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|