how do i use 4 digit numbers
I need to count from:
0-9999
In PHP, how can i make the format:
0000-9999
So that the output is:
0000,0001,0002,....
thank开发者_如何学Gos!
$num = 9;
$paddedNum = sprintf("%04d", $num);
echo $paddedNum; // prints 0009
$number = 9;
echo str_pad($number, 4, '0', STR_PAD_LEFT); // output: 0009
精彩评论