最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

php - How to doc a variable number of parameters - Stack Overflow

programmeradmin1浏览0评论

How do I doc a variable number of parameters? I am writing an application in PHP and JavaScript. Currently I have (in JavaScript):

/**
 * Description
 * @param {String} description
 */
function fn()
{
  // arguments holds all strings.
}

So, how do I doc n-number of string params?

How do I doc a variable number of parameters? I am writing an application in PHP and JavaScript. Currently I have (in JavaScript):

/**
 * Description
 * @param {String} description
 */
function fn()
{
  // arguments holds all strings.
}

So, how do I doc n-number of string params?

Share Improve this question edited Aug 28, 2010 at 10:48 Tower asked Aug 28, 2010 at 10:42 TowerTower 103k131 gold badges364 silver badges521 bronze badges 3
  • 2 Not sure whether "doctype" is the correct choice of word here. – Pekka Commented Aug 28, 2010 at 10:45
  • Do you mean how to write those parameters in the jsdoc? – 2ndkauboy Commented Aug 28, 2010 at 10:49
  • 1 Are you asking for Javascript or PHP? Your code is JS, but you accepted a PHP answer. If its PHP, please change (or remove) the example and also remove the javascript and jsdoc tags. For JS there already is an answer to this in the linked question (stackoverflow./questions/4729516/…). – studgeek Commented May 3, 2011 at 18:00
Add a ment  | 

1 Answer 1

Reset to default 12

E.g. PhpDocumentor suggests using an ellipsis

/**
 * Example of unlimited parameters.
 * Returns a formatted var_dump for debugging purposes
 * (since the recurrences of $v are not listed in the actual function signature in the code,
 * you may wish to highlight they are "optional" in their description)
 * @param string $s string to display
 * @param mixed $v variable to display with var_dump()
 * @param mixed $v,... unlimited OPTIONAL number of additional variables to display with var_dump()
 */
function fancy_debug($s,$v)
{
发布评论

评论列表(0)

  1. 暂无评论