开发者

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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜