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

How to convert octal to decimal in php

藏色散人
Release: 2023-03-14 21:52:02
Original
2354 people have browsed it

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
Copy after login

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

The above routine will output:

63
45
Copy after login

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!

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