@param

(phpDocumentor 0.1+ )

@param --  document a function parameter

Description

@param datatype [$paramname] [description]

NOTE: as of 0.4.1, @param can document phpdoc.de-style, with optional $paramname

datatype should be a valid PHP type or "mixed." 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:

phpDocumentor will display the optional description unmodified

Here's an example:

/**
* example of basic @param usage
* @param bool $baz
* @return mixed
*/
function function1($baz)
{
   if ($baz)
   {
      $a = 5;
   } else
   {
      $a = array(1,4);
   }
   return $a;
}

class class1
{
   /**
   * example of documenting a method, and using optional description with @return
   * @return string de-html_entitied string (no entities at all)
   */
   function bar($foo)
   {
      return strtr($foo,array_flip(get_html_translation_table(HTML_ENTITIES)));
   }
}

/**
* Example of documenting undetermined function arguments
* @param string $foo
* @param mixed $foo_desc optional description of foo
*/
function function2($foo)
{
   echo $foo;
   if (func_num_args == 2)
   {
      echo 'Description: '.func_get_arg(1);
   }
}

/**
* Example of unlimited parameters.
* Returns a formatted var_dump for debugging purposes
* @param string $s string to display
* @param mixed $v variable to display with var_dump()
* @param mixed $v,... unlimited number of additional variables to display with var_dump()
*/
function fancy_debug($s,$v)
{
   print $s."
\n"; var_dump($v); if (func_num_args()>2) { for($i=2;$i\n"; } } print "
\n"; }

Tag Documentation written by Gregory Beaver <cellog@users.sourceforge.net>
Copyright © 2002, Gregory Beaver