PHP学习

php注释


用于描述代码功能,不会被视为php代码.

php注释分单行注释和多行注释

php单行注释使用: // 或 #

php多行注释使用:/* 中间为注释内容 */

例如:

<?php
    echo "This is a test"; // This is a one-line c++ style comment
    /* This is a multi line comment
       yet another line of comment */
    echo "This is yet another test";
    echo 'One Final Test'; # This is a one-line shell-style comment
?>

要确保不要嵌套多行注释。试图注释掉一大块代码时很容易出现该错误。

<?php
 /*
    echo "This is a test"; /* This comment will cause a problem */
 */
?>