PHP - Math decoct() Function
The PHP Math decoct() function is used to return a string which is the octal representation of a decimal number.
Syntax
decoct(number)
Parameters
number |
Required. Specify the decimal number to convert. |
Return Value
Octal string representation of a decimal number.
Example:
In the below example, decoct() function is used to return the octal string representation of a given decimal number.
<?php $x = 100; $y = 500; $z = 1000; echo "decoct($x) returns: ".decoct($x)."\n"; echo "decoct($y) returns: ".decoct($y)."\n"; echo "decoct($z) returns: ".decoct($z)."\n"; ?>
The output of the above code will be:
decoct(100) returns: 144 decoct(500) returns: 764 decoct(1000) returns: 1750
❮ PHP Math Functions