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!

Reply via email to