PHP Class & Function Comments

If you have seen that some PHP functions and classes are commented at the top, using a format like this:

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

So you might be interested what is this format of commenting and where can you find some information on it? so here I tell about commenting PHP functions and class in short!


 * 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


 * Short description for class
 * Long description for class (if any)...
 * @copyright  2006 Zend Technologies
 * @license   PHP License 3.0
 * @version    Release: @package_version@
 * @link
 * @since      Class available since Release 1.2.0

That’s basically phpDoc syntax.

You can read more here: phpDocumentor


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s