sprintf() question
| From: | SpamSucks86 | Date: | Thu, 29 Aug 2002 16:06:35 +0000 |
| Subject: | sprintf() question | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-114516@lists.php.net to get a copy of this message | ||
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!