PHP教程
PHP Mysql
PHP面向对象
PHP常用

PHP 注释

PHP 注释

PHP 注释可用于描述任何代码行,以便其他开发人员可以轻松理解代码。它也可以用来隐藏任何代码。
PHP 支持单行和多行注释。这些注释类似于 C/C++ 和 Perl 风格(Unix shell 风格)的注释。

PHP 单行注释

有两种使用单行注释的方法在 PHP 中。
//(C++ 风格的单行注释) #(Unix Shell 风格的单行注释)
<?php
// this is C++ style single line comment
# this is Unix Shell style single line comment
echo "Welcome to PHP single line comments";
?>
输出:
 Welcome to PHP single line comments 

PHP 多行注释

在 PHP 中,我们也可以注释多行。为此,我们需要将所有行括在/* */中。让我们看一个简单的 PHP 多行注释示例。
<?php
/*
Anything placed
within comment
will not be displayed
on the browser;
*/
echo "Welcome to PHP multi line comment";
?>
输出:
 Welcome to PHP multi line comment 
昵称: 邮箱:
Copyright © 2022 立地货 All Rights Reserved.
备案号:京ICP备14037608号-4