Home  >  Article  >  Backend Development  >  PHP provides several code comment styles, what are they?

PHP provides several code comment styles, what are they?

青灯夜游
青灯夜游Original
2022-01-24 15:45:182194browse

php provides 3 code comment styles, which are: 1. C-style single-line comments, the syntax is "//comment content"; 2. C-style multi-line comments, the syntax is "/* comment content" */"; 3. UNIX-style single-line comments, the syntax is "# comment content".

PHP provides several code comment styles, what are they?

The operating environment of this tutorial: Windows 7 system, PHP version 7.1, DELL G3 computer

Comments in the PHP code will not be treated as programs to read and execute. Its function:

  • Code explanation

  • Description of script related information

  • Convenient for debugging, Test

php provides 3 code comment styles:

①Single line comment (C style), symbol: //

<?php
echo "单行注释" ;//一般在代码右边少量说明或写在代码前面使之失效
?>

②Multi-line comments (C style), symbols: /* */

<?php
echo "多行注释" ;
echo "多行注释" ;
/*
一般说明脚本的相关信息,如版本,版权,作者日期等
使一长段代码失效
*/
?>

③Special single-line comments (not commonly used, UNIX style), Symbol:

#
<?php
echo "单行注释" ;#一般在代码右边少量说明或写在代码前面使之失效
?>

Recommended study: "PHP Video Tutorial"

The above is the detailed content of PHP provides several code comment styles, what are they?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:What does php probe mean?Next article:What does php probe mean?