PHP provides several code comment styles, what are they?

青灯夜游
Release: 2023-03-15 06:04:01
Original
2157 people have browsed it

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 "单行注释" ;//一般在代码右边少量说明或写在代码前面使之失效
?>
Copy after login

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

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

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

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

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!