Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does php have a built in coversion to base32 values?

Tags:

php

base32

I know I can use number_format, but is there a way to represent base32 numbers? For example, hex can be represented with 0x... and octal can be represented with a 0 in the front. Is there anything to represent base32 numbers in php?

like image 427
Daniel Avatar asked Mar 12 '26 03:03

Daniel


2 Answers

Use the built-in function base_convert. For example:

// To convert from base 10 to base 32:
echo( base_convert( 12345, 10, 32 ) );
like image 70
Jon Benedicto Avatar answered Mar 14 '26 17:03

Jon Benedicto


I never seen a native notation for base32, but there is ofcourse Base_convert() .

like image 33
Willem Avatar answered Mar 14 '26 15:03

Willem