Sequential numbering in PHP -


i want create sequential numbering in php, how that?

example

0000009 

next number

0000010 

i have tried using sprintf or str_pad didn't format

sprintf('%08d', 1234567) + 1; str_pad($value, 7, '0', str_pad_left) + 1; 

output:

2 

you can use loop , precisely while loop that. after number has been generated use str_pad add number of zeros want. in while loop must have criteria or else iterate on , on again. example

$number = 1;  while ($number <= 10) {     echo str_pad ($number, 7, '0', str_pad_left), '<br>';     $number++; // or rule want. } 

that's it


Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -