对于php函数代码,您如何评论代码?这是正确的还是最好的方法?你如何评论PHP功能内的代码?
function menu_element_builder($values) {
//$links = '';
}
对于php函数代码,您如何评论代码?这是正确的还是最好的方法?你如何评论PHP功能内的代码?
function menu_element_builder($values) {
//$links = '';
}
注释行//
或#
,由您决定。
注释部分行或全部代码块,其中/* [commented code] */
。
function menu_element_builder($values/*, $optional_value*/) {
#Commented out line
echo "Not commented out";
//Commented out line
echo "Not commented out";
/* Commented out code block
echo "Commented out"; */
echo "Not commented out"; //but this is ." and so's this";
echo "Not commented out" /* but this is */ ." and this isn't";
/* This is commented out */ echo "But this isn't";
}
<?php
// This is a single-line comment
# This is also a single-line comment
/*
This is a multiple-lines comment block
that spans over multiple
lines
*/
// Aswell you can use comments to hide part of your code from execution
$x = 5 /* + 15 */ + 5;
echo $x;
?>
//和/ * * /。我不知道如果在评论代码最好的方法:d – user489872
那么,如果你需要注释掉的代码,你应该问自己,为什么你需要它?如果你不只是可以删除它。 – Rizier123
我只是不确定语法是否在函数内部工作。现在我明白了! – DDJ