newbie question
| From: | Wang Feng | Date: | Sun, 12 Oct 2003 08:09:21 +0000 |
| Subject: | newbie question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-165881@lists.php.net to get a copy of this message | ||
Greetings,
This is the example from the php manual:
***************************************
Example 6. sprintf(): formatting currency
<?php
$money1 = 68.75;
$money2 = 54.35;
$money = $money1 + $money2;
// echo $money will output "123.1";
$formatted = sprintf("%01.2f", $money); // my question comes here
// echo $formatted will output "123.10"
?>
***************************************
I don't understand the meaning of the 01 above, which follows the % sign. I
tried the "%.2f" and "%1.2f", both work fine. So, what's the meaning of
01(especially what the 0 is for)? Seems very much the same as C anyway :-).
Please explain.