Reputation: 68084
%01.2f
I know ".2" is the precision, but what does the 1st part mean - %01
?
I tried changing it to 05, 2 etc and the resulted string looks the same..
Upvotes: 1
Views: 591
Reputation: 15813
It is useful to print columns. For example, if you want to print into one column of 50 characters a number with 4 floating digits, and want to fill with 0s the beginning of the number , you use:
%050.4f
If you want to fill with spaces instead of 0s the beginning of the column, you use instead:
% 50.4f
Upvotes: 2
Reputation: 1633
That is how much spacing is there. It's back from printf in C. Looking up printf would give you more information. However, it's simple enough to explain here.
I am guessing that the reason it doesn't do anything is because HTML doesn't allow more than 1 consecutive space and so it doesn't show up but if you ran your PHP in a command line (it's possible) then you would see the spacing appear.
For instance in C (php is basically a C language for the web) you could say
printf("%20s %20s!", "Hello", "World");
And that would print out something like this
Hello World!
in normal html it should show as this (not in a 'code block') : Hello World!
^^ That is spaced the same in the code btw.
Upvotes: 1