为什么使用函数
算出来最大的数值
function MaxValue(...$InputValue)
{
$MaxValue = $InputValue[0];
foreach ($InputValue as $temp) {
if ($temp > $MaxValue) {
$MaxValue = $temp;
}
}
echo "The MaxVlue is :", $MaxValue, "\n";
}
MaxValue(454, 123, 451, 23, 4, 2, 3, 1, 2, 1, 4, 555, 4, 1, 2, 5, 4, 4, 4, null);
函数名字,要以下划线或者字母开头,后边可以是字母,下划线,还有数字
- Max_Value,
- __MaxValue,
- __001,
- __007
return返回值,可以不要返回值,直接引用传递就可以了。&
没有返回值的时候,回来的是NULL,想想也对,回来个undefined更加离谱
function __001(){
echo 'how are you',"\n";
}
$aa=__001();
var_dump($aa);