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: $money";
$formatted = sprintf("%01.3f", $money);
echo "This is formatted: $formatted";
?>
HTH,
- E
>
>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 work? What part of the string corresponds to what? Thanks
>for any and all help!
>
_________________________________________________________________
キャリアアップを目指すあなたのナビゲーター MSN 就職・転職
http://career.msn.co.jp/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php