La funzione
1 |
string base_convert(string $numero, int $base_di_partenza, int $base_di_arrivo) |
converte, da base a base, da 2 a 36…
Il codice illustra il comportamento della funzione
1 2 3 4 5 6 7 8 9 10 11 |
base_convert() $decimale = strval(pow(2, 20)); // $decimale = 1048576 for($base=2; $base <= 36; $base++) { $risultato=base_convert($decimale, 10, $base); $risultato=strtoupper($risultato); echo $base . " ==> " . $risultato . " "; } ?> |
Nota
1 2 3 |
pow() // power strval() // string value strtoupper() // string to upper |