Home > Backend Development > PHP Problem > How to convert octal to hexadecimal in php

How to convert octal to hexadecimal in php

藏色散人
Release: 2023-03-15 06:52:02
Original
1946 people have browsed it

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.

How to convert octal to hexadecimal in php

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。";
?>
Copy after login

Output:

八进制的 364 等于十六进制的 f4。
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template