PHP.nl

base_convert

base_convert

Convert a number between arbitrary bases

string **base_convert** string $num int $from_base int $to_base

Returns a string containing represented in base . The base in which is given is specified in . Both and have to be between 2 and 36, inclusive. Digits in numbers with a base higher than 10 will be represented with the letters a-z, with a meaning 10, b meaning 11 and z meaning 35. The case of the letters doesn't matter, i.e. is interpreted case-insensitively. num``to_base``num``from_base``from_base``to_base``num

Waarschuwing: > may lose precision on large numbers due to properties related to the internal type used. Please see the section in the manual for more specific information and limitations. base_convert``floatFloating point numbers

num The number to convert. Any invalid characters in are silently ignored. As of PHP 7.4.0 supplying any invalid characters is deprecated. num

from_base The base is in num

to_base The base to convert to num

converted to base 

num``to_base

Voorbeeld: example

<?php
$hexadecimal = 'a37334';
echo base_convert($hexadecimal, 16, 2);
?>
101000110111001100110100

intval