understanding dollar amount code
Posted: Mon Sep 28, 2009 8:21 pm
Hi, im just starting off learning PHP, and stumbled up on this line of code. Any feedback most appreciated.
Dollar amount Code
I understand this code is correct, but Im just having trouble comprehending it.
I would like to know what ("%01 means. (as in what it stands for) I know that ("%01.2f" (highlighted in bold) places an extra " 0 " at the end of 25.000
sorry to ask such a noob question, im currently learning from PHP & MySQL for dummies book.
thx.
S.S.
Dollar amount Code
Code: Select all
$price =25;
$f_price = sprintf("%01.2f",$price);
echo "$fprice";I would like to know what ("%01 means. (as in what it stands for) I know that ("%01.2f" (highlighted in bold) places an extra " 0 " at the end of 25.000
sorry to ask such a noob question, im currently learning from PHP & MySQL for dummies book.
thx.
S.S.