PHP decoct Function – Convert Decimal to Octal
This article explains the PHP decoct function, which returns the octal representation of a given decimal integer, details its parameter and return value, and provides example code demonstrating conversions such as 15 → 17 and 264 → 410.
The decoct function in PHP converts a decimal integer to its octal string representation. It accepts a single integer argument $number and returns a string containing the octal value, supporting numbers up to 4,294,967,295 (resulting in "37777777777").
Parameter:
int $number – the decimal value to be converted.
Return value:
A string representing the octal form of the provided number.
Example usage:
<?php
echo decoct(15)."\n";
echo decoct(264);
?>Running the above code outputs:
17
410Laravel 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.