如何注释php函数中的代码?

如何注释php函数中的代码?,php,Php,对于php函数代码,如何注释代码?这是正确的还是最好的方法 function menu_element_builder($values) { //$links = ''; } 根据需要,用//或注释掉行 用/*[注释代码]*/注释部分行或整个代码块 //和/***/。。我不知道在注释代码时是否有最好的方法:停顿如果你需要注释掉代码,你应该问问自己为什么需要它?如果你不知道的话,你可以删除它。我只是不确定函数中的语法是否也一样。现在我知道了!不要使用,我相信它是不推荐的。仅在.ini文件中不推荐

对于php函数代码,如何注释代码?这是正确的还是最好的方法

function menu_element_builder($values) {
//$links = '';
}
根据需要,用//或注释掉行

用/*[注释代码]*/注释部分行或整个代码块


//和/***/。。我不知道在注释代码时是否有最好的方法:停顿如果你需要注释掉代码,你应该问问自己为什么需要它?如果你不知道的话,你可以删除它。我只是不确定函数中的语法是否也一样。现在我知道了!不要使用,我相信它是不推荐的。仅在.ini文件中不推荐使用//或/**/@Nitin。对于PHP文件来说没问题。@Nitin实际上它们不是-它们只在.ini文件中被弃用。
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;
?>