Say I have a variable month storing a two digit value of the month.
$month = 10 ;
What would the below piece of code do:
$a = sprintf("%02d",$month);
| SitePoint Sponsor |

Say I have a variable month storing a two digit value of the month.
$month = 10 ;
What would the below piece of code do:
$a = sprintf("%02d",$month);
Bardius





It would force 0 out to 2 places so it would have no effect on 10 but it would turn an 8 into a 08.
Please don't PM me with questions.
Use the forums, that is what they are here for.
Bookmarks