function getIntAdd($a,$b){
$c = '';
$bCount = strlen($b);
$aCount = strlen($a);
$count = max($bCount,$aCount);
$aDiff = $count - $aCount;
$bDiff = $count - $bCount;
for($i = $count - 1;$i >= 0;$i--){
$aVal = $count - $i <= $aCount ? intval($a[$i - $aDiff]) : 0;
$bVal = $count - $i <= $bCount ? intval($b[$i - $bDiff]) : 0;
$v = $aVal + $bVal;
if(strlen($c) > 0 && strlen($c) >= $count - $i){
$c = ($v + intval($c[0])).substr($c,1,strlen($c) - 1);
}else{
$c = $v.$c.'';
}
}
return $c;
}
$a = '23490234328490289048902384908392849238';
$b = '234320498324982390489328498230984982399290384902384';
$c = getIntAdd($a,$b);
print_r($c);
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。