3v4l.org

run code in 300+ PHP versions simultaneously
<?php $tax = bcmul("33.95", ".065", 2); // 2.20675 $real_total = bcadd("33.95", "7.87", 2); // 41.82 //$real_total = bcadd($real_total, $tax, 2); // 44.02675 echo $real_total; function bcround($number, $scale = 0) { $fix = "5"; for ($i=0; $i<$scale; $i++) $fix = "0$fix"; $number = bcadd($number, "0.$fix", $scale + 1); return bcdiv($number, "1.0", $scale); }

preferences:
60.14 ms | 402 KiB | 5 Q