views:

1547

answers:

2

Just a quick question: I've seen that some PHP functions are commented at the top, using a format that is unknown to me:

/**
 *
 * Convert an object to an array
 *
 * @param    object  $object The object to convert
 * @return      array
 *
 */

My IDE gives me a dropdown selection for the things such as @param and @return, so it must be documented somewhere. I've tried searching google but it won't include the @ symbol in its search.

What is this format of commenting and where can I find some information on it?

+10  A: 

That's phpDoc syntax.

Read more here: phpDocumentor

Josh Leitzel
Looks like a copy of javadoc.
Matt H
It's the same idea, just for PHP instead of Java.
Josh Leitzel
+1  A: 
Functions:
/**
* Does something interesting
*
* @param Place $where Where something interesting takes place
* @param integer $repeat How many times something interesting should happen
* @throws Some_Exception_Class If something interesting cannot happen
* @return Status
*/

Classes:
/**
* Short description for class
*
* Long description for class (if any)...
*
* @copyright 2006 Zend Technologies
* @license http://www.zend.com/license/3_0.txt PHP License 3.0
* @version Release: @package_version@
* @link http://dev.zend.com/package/PackageName
* @since Class available since Release 1.2.0
*/
waqar alamgir
It is not necessary to use the "@access" tag because the access level is already known from the "public", "private", or "protected" construct used to declare the function.
waqar alamgir