[man]printf[/man] is for outputting formatted data
$var = 12.34567;
printf('%0.2f',$var);
takes a floating point value, $var, and formats it to 2 dec places so you get
12.35
Simailarly, %s, %d are for string and integers.
so printf ('%03d', 7) gives 007
(integer 3 chars with leading 0's)
See [man]sprintf[/man] for full explanation.
hth