3v4l.org

run code in 500+ PHP versions simultaneously
<?php use BcMath\Number; $a = new Number('1.005691112'); $b = new Number('2.567891112'); $result = $a * $b; echo $result->round(2); echo PHP_EOL; echo $result; echo PHP_EOL; echo 1.005691112 * 2.567891112; echo PHP_EOL; echo 'precision is '.ini_get('precision');
Output for 8.2.31, 8.3.0 - 8.3.31, 8.5.0 - 8.5.7
Fatal error: Uncaught Error: Class "BcMath\Number" not found in /in/jCCU2:5 Stack trace: #0 {main} thrown in /in/jCCU2 on line 5
Process exited with code 255.
Output for 8.4.1 - 8.4.22
2.58 2.582505267922196544 2.5825052679222 precision is 14

preferences:
58.23 ms | 753 KiB | 4 Q