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?
+1
A:
I never seen a native notation for base32, but there is ofcourse Base_convert()
.
Wimmer
2009-12-04 18:00:39
+1
A:
number_format()
cannot be used to 'represent' a base 32 number, I wonder if you mean base_convert
(http://php.net/base_convert) to move between bases, e.g.
echo(base_convert('FF', 16, 10));
As for defining them with a special prefix, as far as I'm aware PHP only supports 0 and 0x for octal/hexadecimal.
pyo
2009-12-04 18:01:12
+3
A:
Use the built-in function base_convert. For example:
// To convert from base 10 to base 32:
echo( base_convert( 12345, 10, 32 ) );
Jon Benedicto
2009-12-04 18:02:04