php method to convert octal to hexadecimal: 1. Create a PHP sample file; 2. Convert octal numbers to hexadecimal through the "base_convert($oct,8,16);" method Just count.
The operating environment of this article: Windows7 system, PHP7.1 version, DELL G3 computer
How to convert octal to hexadecimal in php system?
base_convert() function converts numbers between arbitrary bases.
Convert octal number to hexadecimal number:
<?php $oct = "364"; $hex = base_convert($oct,8,16); echo "八进制的 $oct 等于十六进制的 $hex。"; ?>
Output:
八进制的 364 等于十六进制的 f4。
Recommended learning: "PHP Video Tutorial"
The above is the detailed content of How to convert octal to hexadecimal in php. For more information, please follow other related articles on the PHP Chinese website!