PHP octdec()
Published Dec 12, 2023
The octdec() function is a built-in function that calculates the decimal equivalent of an octal number. It accepts the octal number as the only argument.
Syntax
octdec(value);
value: An octal number given as a parameter to the function in string format. If an invalid character is passed, it is ignored.
Example
The example below uses the octdec() function to convert an octal number to its decimal value.
<?phpecho octdec("65") . "<br>";echo octdec("3098") . "<br>";?>
This example will give the following output:
5324
Codebyte Example
Run the code below to get a better idea of how the octdec() function works:
Learn PHP on Codecademy
- Looking for an introduction to the theory behind programming? Master Python while learning data structures, algorithms, and more!
- Includes 6 Courses
- With Professional Certification
- Beginner Friendly.75 hours