functionadd($a,$b){$a = strrev($a); $b = strrev($b); $tmp = 0; $tmp_c = 0; $count = ''; $len = strlen($a)>strlen($b)?strlen($a):strlen($b); for($i=0;$i$len;$i++){ if(isset($a[$i]) && isset($b[$i])){ $tmp_c = $a[$i] + $b[$i] + $tmp; if($tmp_c > 10) { $tmp = 1; $count = substr($tmp_c,1).$count; } else { $tmp = 0; $count = $tmp_c.$count; } } elseif(isset($a[$i])) { $tmp_c = $a[$i] + $tmp; if($tmp_c > 10) { $tmp = 1; $count = substr($tmp_c,1).$count; } else { $tmp = 0; $count = $tmp_c.$count; } } elseif(isset($b[$i])) { $tmp_c = $b[$i] + $tmp; if($tmp_c > 10) { $tmp = 1; $count = substr($tmp_c,1).$count; } else { $tmp = 0; $count = $tmp_c.$count; } } } return$count; }
版权声明:转载请保留文章署名和链接
以上就介绍了php大数据加法,包括了方面的内容,希望对php教程有兴趣的朋友有所帮助。