Home >Backend Development >PHP Problem >How to add comments in php

How to add comments in php

王林
王林forward
2019-09-04 17:22:527528browse

How to add comments in php

Comments are very important in the process of writing code. Good comments can make your code easier to read. When writing code, you must pay attention to the specification of comments.

Several common comment methods in php:

1. Comments in the file header, introducing the file name, function, author version number and other information

/** 
*文件名简单介绍
* 
*文件功能。 
* @author      alvin 作者
* @version     1.0 版本号
*/

2. Function comments, function functions, parameter introduction and return type

/**  
* 函数的含义说明 
* 
* @access public 
* @param mixed $arg1 参数一的说明 
* @param mixed $arg2 参数二的说明 
* @param mixed $mixed 这是一个混合类型 
* @return array 返回类型
*/

3. Class comments, class name and introduction

/** 
* 类的介绍 
* 
* 类的详细介绍(可选。)。 
* @author      alvin 作者 
* @version     1.0 版本号
*/

4. Multi-line comments

/* php注释语法
   这是多行注释。*/

5. Single-line comments

$n = 10; //数量n,这是单行注释

The above is php The annotation specification content is for your reference only.

For more related questions, please visit the PHP Chinese website: PHP Video Tutorial

The above is the detailed content of How to add comments in php. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:cnblogs.com. If there is any infringement, please contact admin@php.cn delete
Previous article:What is the suffix php?Next article:What is the suffix php?