Basically, I need to generate a list of all seven-digit numbers (for example, 1461979) from 0000000 to 9999999. I know there are 10^7 of them (ten million), but I can’t think of an efficient function to output them. I’m sure there’s a generic function out there that can do it – preferably in PHP, but I can port it if need be.
Basically, I need to generate a list of all seven-digit numbers (for example, 1461979)
Share
Loop from 0 to 9999999 and use one of the dozens of methods for zero-filling a number, such as
printf("%07d", $val).