PHP: generate a number from xyz0000 to xyz9999 -
i trying generate list of numbers (that can use in for/foreach cycle).
any number should 10 digits long , have initial prefix (i.e. 0851)
0851xxxxxx
, go 0851000000
0851999999
range('0851000000','0851999999')
however array take as 84mb in memory (as reported memory_get_usage(1)
)
less memory consuming way generate these numbers on fly, while iterate in loop.
for example
for($a = 851000000; $a <= 851999999; $a++) { $number = '0'.(string)$a; dosomethingwith($number); }
Comments
Post a Comment