Example:
/**
* This function will determine whether or not one string starts with another string.
* @param string $haystack <p>The string that needs to be checked.</p>
* @param string $needle <p>The string that is being checked for.</p>
* @param boolean $case[optional] <p>Set to false to ignore case(capital or normal characters)</p>
* @return boolean <p>If the $haystack string does start with the $needle string, the return will be true. False if not.</p>
*/
function endsWith($haystack,$needle,$case=true) {
if($case){return (strcmp(substr($haystack, strlen($haystack) - strlen($needle)),$needle)===0);}
return (strcasecmp(substr($haystack, strlen($haystack) - strlen($needle)),$needle)===0);
}
可选参数设置为true
默认情况下。我想在文档中指出默认设置是什么。是否有执行此操作的标准方法,或者我是否必须在说明中提及?
医生说 http://manual.phpdoc.org/HTMLSmartyConverter/HandS/phpDocumentor/tutorial_tags.param.pkg.html:
请注意,$paramname,...将是
显示在输出文档中
参数列表和功能
签名。如果您不表明
在实际代码中,参数
是可选的(通过“$paramname = 'a
默认值'"),那么你应该
在参数描述中提及
该参数是可选的。
因此,如果您没有在函数签名中显示默认分配,最好将其包含在描述中,但在您的情况下,您are将其包含在签名中。所以,你不需要改变任何事情,除非这样做会让你感觉更好。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)