开发者

how do i use 4 digit numbers

开发者 https://www.devze.com 2023-03-15 12:14 出处:网络
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,....

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

精彩评论

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