Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In PHP you can have a function take an infinite number of arguments like

   * Do abc...
   * @since   1.0
   * @param   mixed $arg1       Arg description
   * @return  string            Results
function abc($arg1 = null){
  $args = func_get_args();
  // do smth with $args

How should I illustrate this in my DocBlock ?

share|improve this question
up vote 3 down vote accepted manual example:

 * @param mixed $varname,... unlimited OPTIONAL number of additional variables [...]

You may document parameters listed or any optional paramters that will be parsed by standard PHP functions func_num_args()/get_func_arg(). Recommended name format for parameters listed with func_get_arg() is:

  • $paramname if there is only one parameter
  • $paramname,... if the number of parameters is unlimited

phpDocumentor will display the optional description unmodified.

Note that the $paramname,... will be shown in the output docs in both the parameter listing AND the function signature. If you are not indicating in the actual code that the parameter is optional (via "$paramname = 'a default value'"), then you should mention in the parameter's description that the parameter is optional.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.