manghe/app/api/common.php
2025-03-21 19:25:07 +08:00

30 lines
675 B
PHP
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
// 这是系统自动生成的公共文件
/**
* 运算
*/
function jisuan($num1,$num2,$opt,$length){
switch($opt){
case "+":
$rs=bcadd("$num1","$num2",$length);
break;
case "-":
$rs=bcsub("$num1","$num2",$length);
break;
case "*":
$rs=bcmul("$num1","$num2",$length);
break;
case "/":
if($num2==0){
exit("被除数不能为0");
}else{
$rs=bcdiv("$num1","$num2",$length);
}
break;
default:
echo "异常操作!";
break;
}
return $rs;
}