PHP 程式設計/格式化筆記
外觀
< PHP 程式設計
| 一位華夏公益教科書使用者建議將本書或章節與 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);
?>