Home > Article > Backend Development > How to convert octal to decimal in php
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.
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('77') . "\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!