开发者

How to make sections of PHP code in eclipse

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();
e开发者_如何学运维cho $result;
/** End Section "Blah" */


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).


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜