printf %f,%10f,%-010f,%2.2f : Printf « Development « PHP

printf %f,%10f,%-010f,%2.2f


$value = 3.14159;
printf("%f,%10f,%-010f,%2.2f\n", $value, $value, $value, $value);


Related examples in the same category

1.Type Specifiers
2.printf: Specifying a Field Width
3.Using printf() to Format a List of Product Prices
4.printf: %d
5.printf: %b
6.printf: %X (uppercase X)
7.printf: %x (lowercase x)
8.printf: %s
9.printf: %o
10.printf: %f
11.printf: right-pad with dashes: %'--6s
12.printf: Left-pad the string %s, %-6s
13.printf: octal representation %o
14.printf:hexadecimal representation %X
15.printf: hexadecimal representation %x
16.printf: left-pad a number and specify precision: %05.2f
17.printf: %05f
18.printf: %f, %.2f
19.printf: %d, %c