Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what is /** in php?

Tags:

php

what is the meaning of /** in php example

/**
     * Method to display a view.
     *
     * @param   boolean         If true, the view output will be cached
     * @param   array           An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
     *
     * @return  JController     This object to support chaining.
     * @since   1.5
     */

i cant seem to search about it? what is the keyword to use for me to be able to search on it? does it go into the code or just a comment?

like image 497
interesting eyy Avatar asked Dec 03 '22 02:12

interesting eyy


2 Answers

This is called DocBlock style commenting. In general, code should be commented prolifically. It not only helps describe the flow and intent of the code for less experienced programmers, but can prove invaluable when returning to your own code months down the line. This is not a required format for comments, but it is recommended.

DocBlock style comments preceding class and method declarations so they can be picked up by IDEs:

    /** 
    * Super Class *
    * @package Package Name 
    * @subpackage Subpackage 
    * @category Category 
    * @author Author Name 
    * @link http://example.com 
    */
     class Super_class {

Source:Click!

In IDEs like netbeans,this commenting style is detected and the * pointers are automatically generated (like in listing pointers). All you have to do is open /** and press Enter!

like image 74
Bhuvan Rikka Avatar answered Dec 05 '22 16:12

Bhuvan Rikka


/* starts a comment. Anything else after that, until the first */ is part of the comment, so the second * in /** is nothing special - just part of the comment. Some in-line documentation/code annotation systems may find it significant, but to PHP it means absolutely nothing.

like image 25
Marc B Avatar answered Dec 05 '22 15:12

Marc B