I have to pass an index to a function and from that index return a string containing from 1 to 4 chars.
I have:
$string = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
So if I say index(20) the function should return lower "k" because it is its index in the $string variable.
But...
If I type indexes
62 it should return 10
63 .. 11
That is because from index 62 it should start the string from 1, not 0, and loop until the next index, so they will be 2 length string
If I type indexes
3843 .. ZZ
That is because from index 3843 all the possibilities from [0-9a-zA-Z][0-9a-zA-Z] have ended and now the string starts with 3 length.
3844 .. 100
...
9999 .. 2Bh
All the possibilities and at [0-9a-zA-Z][0-9a-zA-Z][0-9a-zA-Z] but I only need until index 9999