Phpbase_convert ()-based numeric conversion function. The base_convert () function converts numbers in any hexadecimal format. The base_convert (number, frombase, tobase) parameter description number is required. Original value. Frombase is required. The original base e_convert () function of the number converts the number between any hexadecimal values.
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"
";
$ Number = "123 ";
Echo base_convert ($ number, 1111011); // Convert to binary output
Echo"
";
Echo base_convert ($ number, 10, 8); // Convert to octal output 173
Echo"
";
Echo base_convert ($ number, 10, 16); // Convert to hexadecimal output 7b
$ Number2 = "100000101 ";
Echo"
";
Echo base_convert ($ number2, 2, 10); // Convert to decimal output 261
Echo"
";
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.
The http://www.bkjia.com/PHPjc/445382.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/445382.htmlTechArticlebase_convert () function converts numbers between any given hexadecimal order. The base_convert (number, frombase, tobase) parameter description number is required. Original value. Frombase is required. The original number in hexadecimal format...