php - Generate incremental id of numbers, Upper and Lower letters -
how can generate incremental id in php mixing numbers, lower , upper letters?
for example, tried:
$hello = "aaa0"; ($i=0; $i < 10000; $i++) { echo $hello++; echo "<br>"; }
then, returns;
aaa0 aaa1 aaa2 ... aaa9 aab0 aab1
i generate strings as:
aaa0 aaa1 aaa2 ... aaaa aaab aaac ... aaaz aaaa
first numbers 0 9, chars z, chars z. each positional char should go in range.
how can it?
edit: want every character in string varies within range. want go 0 9, z, z. when ends, char go 0, , char in left increments in one. example:
0000 0001 0002 ... 0009 000a 000b ... 000y 000z 000a 000b ... 000x 000z 0010 0011 0012 .... 0019 001a
using 0,1-9, a-z , a-z "base 62". converting base 10, base 62 easy in php.
<?php echo base_convert(10123, 10,26), "\n"; // outputs: 'ep9' echo base_convert('ep9', 26, 10), "\n"; // output 10123
Comments
Post a Comment