Home  >  Article  >  Backend Development  >  How to convert octal to decimal in php

How to convert octal to decimal in php

藏色散人
藏色散人Original
2022-01-21 09:16:042295browse

How to convert octal to decimal in php: 1. Create a PHP sample file; 2. Use the "octdec(string $octal_string): number" syntax to convert octal to decimal.

How to convert octal to decimal in php

The operating environment of this article: Windows 7 system, PHP version 7.1, DELL G3 computer

How to convert octal to decimal in php?

octdec

(PHP 4, PHP 5, PHP 7, PHP 8)

octdec — Convert octal to decimal

Description

octdec(string $octal_string): number

Returns the decimal equivalent of the octal number represented by the octal_string parameter.

Parameter octal_string: the octal string to be converted

Return value

The decimal representation of octal_string

Update log

Version Description

4.1.0 This function can handle integer large numbers, in which case it will return float type.

Example

Example #1 octdec() Example

<?php
echo octdec(&#39;77&#39;) . "\n";
echo octdec(decoct(45));
?>

The above routine will output:

63
45

Recommended learning: "PHP Video Tutorial

The above is the detailed content of How to convert octal to decimal in php. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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