note 102040 deleted from function.number-format by cmb

From: Date: Sun, 13 Jan 2019 10:47:08 +0000
Subject: note 102040 deleted from function.number-format by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-210058@lists.php.net to get a copy of this message
Note Submitter: info at swedishboy dot se ---- There has been some suggestions around on how to keep trailing zeros. Best way is to use the example for currency provided by the php-crew in the sprintf function help section. That is: <?php $money1 = 68.75; $money2 = 54.35; $money = $money1 + $money2; // echo $money will output "123.1"; $formatted = sprintf("%01.2f", $money); // << this does the trick! // echo $formatted will output "123.10" ?>

« previous php.notes (#210058) next »