您的位置:首页 > 编程语言 > PHP开发

php实现产生随机数并累加

2011-11-15 22:03 183 查看
<?php

//产生随机数

function int_print(){

//指定在0-99之间产生

for($i=0;$i<=rand(0,99);$i++){

$arr[]=rand(0,9);

}

$arr[0]=rand(1,9);

return $arr;

}

$int1=implode("",int_print());

echo $int1;

//累加

function add($int2,$int3,$len){

for($i=0;$i<=rand(0,99);$i++){

$count=$int2[$i]+$int3[$i];

for($j=0;$j<$count;$j++){

If($count[$j]>9){

$int1[$j]-10;

$int2[$j-1]+1;

}

}

}

return $count;

}

?>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: