PHP base_convert function
The function of PHP base_convert function can convert numbers between arbitrary bases. For example, we can convert a string of hexadecimal system to binary system of digital representation. Through three simple parameter settings, The PHP base_convert function performs conversion. The " ASCII Code Table " provided by this site has commonly used ASCII representations of binary, decimal, and hexadecimal systems. Welcome to use more. The following continues to introduce the syntax and examples of the PHP base_convert function.
PHP base_convert function syntax rules
- string $number: The string to be converted .
- int $frombase: Set the carry system of string $number.
- int $tobase: Set the carry system to be converted.
PHP base_convert function example
$mynumber_1 = '17';
echo base_convert($mynumber_1, 16, 2);
echo'<br>';
$mynumber_2 = '00010111';
echo base_convert($mynumber_2, 2, 16);
?>
17
The "echo'<br>';" in the example is only used to output line breaks. For detailed usage, please refer to: PHP echo line break .
Post a Comment
0 Comments