PHP Annotation Specification

Source: Internet
Author: User

Annotations are important in the process of writing code, and good annotations make your code easier to read, so be sure to note the specification when writing code.

Add comments to the code in the future to develop a good habit. Especially when doing projects for customers, be sure to add.

There are several common annotation methods in PHP:

1. File header comments, introduction of file name, function and author version number and other information

/* * * file name Simple description * * Document function. * @author      Alvin Author * @version     1.0 Version Number * * 

2. Function comment, function, parameter introduction and return type

/* * * The   meaning of the function description * * @access public * @param mixed $arg 1 parameter one of the description * @param mixed $arg 2 parameter two description * @param mixed $mixed This is a mixed Type * @return array return type  */

3. Class comment, class name and introduction

/* * * Class INTRODUCTION * * Class details (optional.) )。 * @author      Alvin Author * @version     1.0 Version Number * * 

4. Multi-line annotations

/* PHP Comment Syntax   This is a multi-line comment. */

5. Single-line Comment

$n // Quantity N, this is a single-line comment

PHP Annotation Specification

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.