Hi I need to make an dynamic array like this:
I have a max number of 25000 and 62 as exponential(?) number.
Array
(
[0] => 0
[1] => 3844 // 62 * 62
[2] => 238328 // 62 * 62 * 62 <---
[3] => 14776336 // 62 * 62 * 62 * 62
)
This is just an example of what I need: calculate the array values and find where fit the max number.
Any Ideas?
$max = floor(log(25000,62));
$array = array_map(function($value){return pow(62,$value);},range(0,$max);
Or, in a total function:
function getpowers($base, $maxvalue){
$max = floor(log($maxvalue,$base));
return array_map(function($value) use ( $base ) {return pow($base,$value);},range(0,$max));
}
var_dump(getpowers(62,25000));