Syntax
Base_convert (number, frombase, tobase) parameter description
Number is required. Original value.
Frombase is required. The original hexadecimal number.
Tobase is required. The hexadecimal format to be converted.
*/
$ Hexadecimal = 'a37334 ';
Echo base_convert ($ hexadecimal, 16,2); // Convert to binary output 101000110111001100110100
Echo "<br> ";
$ Number = "123 ";
Echo base_convert ($ number, 1111011); // Convert to binary output
Echo "<br> ";
Echo base_convert ($ number, 10, 8); // Convert to octal output 173
Echo "<br> ";
Echo base_convert ($ number, 10, 16); // Convert to hexadecimal output 7b
$ Number2 = "100000101 ";
Echo "<br> ";
Echo base_convert ($ number2, 2, 10); // Convert to decimal output 261
Echo "<br> ";
Echo base_convert ($ number2, 2, 8); // Convert to octal output 405
/*
Description
Returns a string containing the number in tobase format. The number is specified by frombase in hexadecimal notation. Both frombase and tobase can only be between 2 and 36 (including 2 and 36 ). Numbers higher than decimal digits are represented by the letter a-z. For example, a represents 10, B represents 11, and z represents 35.