hi there! would it be possible for the number_format function to format numbers 1,2,3,4,5,6,7,8,9 into 01,02,03,04,05,06,07,08,09? if yes, how? or is there another way in doin such? many thanks!!!🙂
have a look at the user contributions in http://www.php.net/manual/fr/function.str-pad.php
Some very clever use of substring, str_pad and regular expressions.
Maybe it would be easier to just use sprintf().
By using that function, it would not add zero in front of numbers that are higher than 9.
example:
$number=3; $formatted=sprintf("%02d",$number); echo $formatted;
Every single day I learn new ways to do things ain't it great? 🙂
Hehe, maybe old dogs really can learn new tricks! 😉
thank you so much! the codes worked perfectly well! 'till next time! 😃