跳轉到內容

PHP 程式設計/格式化筆記

來自華夏公益教科書,開放的書籍,開放的世界

在 PHP 中註釋很簡單且有效。

在程式碼中為自己編寫註釋是跟蹤大型檔案的唯一方法。回到一個沒有註釋的 300 行程式碼頁面可能會是一場噩夢。

要在 PHP 程式碼中插入單行註釋,在該行之前鍵入 //。要在程式碼中插入多行註釋,使用 /* 開始註釋,並使用 */ 結束註釋。例如

<?php

$example = 1

//this is a comment that will be ignored. But will help me remember what the code means.

if (!randomfunction($_POST[dart])){function(example); $example ++;}


/*This is a long
multi-line comment that will
help me remember what the code means.
It will be ignored by the php-
parser*/

randomfuction($example);
?>


華夏公益教科書