How can I know that how much shorturl hashes could be generated by my little app in base62?
So, if I write like this;
$len = 4;
$url = "http://stackoverflow.com/";
// base62
$chrs = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
$hash = generateShortURL($len, $url, $chrs);
I tried pow() but I think that's was wrong, 'cos results are so less than I guess.
for ($i = 4; $i <= 6; $i++) {
echo "62 ^ $i = ". thousandFormat(pow(62, $i)) ."\n";
}
Results;
62 ^ 4 = 14.776.336
62 ^ 5 = 916.132.832
62 ^ 6 = 56.800.235.584
The method you're using is the correct one. 62 ^ 4 will give you the number of hashes 4 characters will give you, and so on.