<?php
function add($a,$b)
{
return $a+$b;
}
$sum=add(23,80.56,45);
echo $sum."<br/>";
$sum=abs(-87.09);//绝对值
echo $sum."<br/>";
//随机数
$randValue=rand(0,1000);
echo $randValue."<br/>";
//round 对浮点数进行四舍五入
echo round(3.4)."<br/>";//3
echo round(3.5)."<br/>";//4
echo round(3.6,3)."<br/>";//3.6
echo round(1.96579,3)."<br/>";//1966
function fun($a,$b,$c)
{
echo $a."<br/>";
echo "{$b}<br/>";
echo "{$c}<br/>";
}
//fun(2,56);少传入参数 报错。参数多的情况下,只要前三个
?>
<?php
/**
* 获取平方值
* @param mixed $a 形参
*/
function fun($a)
{
echo "当前值:{$a}<br/>";
return $a*$a;
}
echo fun(5)."<br/>";
echo fun('a')."<br/>";//0
echo "<hr/>";
//ceil 进一法取整
echo ceil(4.48)."<br/>";//5
?>