Print a number/float in php to two decimal places:
<?php $val = 34.6789; echo sprintf('%0.2f', $val) . "\n"; ?>
34.68
Env: PHP 7.4.33 (Linux)
Print a number/float in php to two decimal places:
<?php $val = 34.6789; echo sprintf('%0.2f', $val) . "\n"; ?>
34.68