I read the manual page on sprintf, but I still don't understand exactly
how the format string works.
$money1 = 68.75;
$money2 = 54.35;
$money = $money1 + $money2;
// echo $money will output 123.1;
$formatted = sprintf(%01.2f, $money);
// echo $formatted will output 123.10
How does that
Experiment a bit and I'm sure you'll find it easy. One example, change this
portion
$formatted = sprintf("%01.2f", $money);
to
$formatted = sprintf("%01.3f", $money);
then see how it works...
?php
$money1 = 68.75;
$money2 = 54.35;
$money = $money1 + $money2;
echo "This is money:
2 matches
Mail list logo