PHP octdec Function: Converting Octal Strings to Decimal Numbers
This article explains PHP's octdec function, detailing its syntax, parameters, return value, and providing example code that demonstrates how to convert an octal string to its decimal equivalent and display the result.
The octdec function in PHP converts a string representing an octal number into its decimal equivalent.
Syntax : number octdec(string $octal_string) Parameter : $octal_string – The octal number expressed as a string that you want to convert.
Return value :
The function returns the decimal representation of the provided octal string.
Example :
<?php
echo octdec('77') . "
"; // converts octal 77 to decimal
echo octdec(decoct(45)); // converts decimal 45 to octal then back to decimal
?>Output :
63
45Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Laravel Tech Community
Specializing in Laravel development, we continuously publish fresh content and grow alongside the elegant, stable Laravel framework.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
