,将“1234567890” 转为 “1,234,567,890”;
function($str,$count){
if(empty($str || $count<=0)){
return false;
}
$str0 = strrev($str);
$str1 = str_spilt($str,$count);
$str2 = implode(',',$str1);
$str3 = strrev($str2);
return $str3;
};
function($n){
$far = 1;
$near = 2;
if($n == 1){
return $far;
}
if($n == 2){
return $near;
}
for($i=3;$i<=$n;$i++){
$count = $near+$far;
$near = $far;
$far = $count;
}
return $count;
}
3,求三个数的最大值 和最小值;
function getMax($a,$b,$c){
$max = $a;
if($b>$max){
$max = $b;
}
if($c>$max){
$max = $c;
}
return $max;
}
最小值同理