|
Posted by Howard on 10/13/96 11:36
Hello everyone (the PHP beginner is back),
I've begun to read the O'Reilly book "Learning PHP 5" and came across a
"rough spot". Actually, I'm just not understanding the explanation on
printf(). It gave the following example (for those of you who have the
book, it's on page 22):
$price = 5; $tax = 0.075;
printf('The dish costs $%.2f' , $price * (1 + $tax));
This prints:
The dish costs $5.38
I know how to figure out a price after tax, but I'm not sure about the
$%.2f part. If someone can shed some light on this, I would greatly
appreciate it.
Thanks everyone,
Howard
Navigation:
[Reply to this message]
|