如果我想将几个值与 BCMath 一起添加,我可以这样做:
$total_cost1 = bcadd($value1, $value2);
$total_cost2 = bcadd($value3, $value4);
$total_cost3 = bcadd($value5, $value6);
$total_cost4 = bcadd($value7, $value8);
$total_cost =
bcadd(bcadd($total1_cost, $total2_cost),
bcadd($total3_cost, $total4_cost));
但它使它变得如此难以理解,而且很容易出错。请告诉我还有另一种解决方法...!?