Question

I've really only just discovered that you can use /** @blah */ comments to specify certain things, but is it possible to create sections in code?

Like:

/** Start Section "Blah" **/
$result = doSomething();
echo $result;
/** End Section "Blah" */
Was it helpful?

Solution

No PDT can't do that. Generally expandable code sections are identified by function and class method bodies.

If you think you need artificial sections identified by comments I recommend to rather think about reorganizing your code into more fine grained files, function, classes and methods that can be easily documented using PhpDoc (which is the standard PDT uses).

OTHER TIPS

these sections

 /**
   * here goes your text
   * @author Nanne
   * /

Are based on javadoc: http://www.oracle.com/technetwork/java/javase/documentation/index-137868.html

Look at this page where a documenter for PHP is described. I don't know what standard is used in Eclipse, but I'm guessing they're all rather alike: http://www.phpdoc.org/

Is is mostly based on commenting certain parts of code, e.g. classes, functions and variables. As far as I know there is no special code for "sections". The reason I think this, is that you are 'supposed' to make a documentation from this, with classes, it's methods etc. There is no special way to represent "sections" in a documentation like that.

But do read above links, it'll clear up a lot!

In PHP you can use sections to separate pieces of code. Syntax is like this:

Blah:{
   $result = doSomething();
   echo $result;
}

These were used by goto style procedural programming before object oriented programming was used (classes and instances). Using these sections and goto statements is very bad practice and should be shunned by any developer.

https://www.php.net/manual/en/control-structures.goto.php

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top