PHP decoct() Function

Definition and Usage

The decoct() function converts decimal to octal.

Syntax

decoct(dec_number)
Parameter Description
dec_number Required. Specifies the decimal number to be converted.

Description

Returns a string containing the given dec_number Octal representation of the parameter. The maximum number that can be converted is decimal 4294967295, which results in "37777777777".

Example

<?php
echo decoct("30");
echo decoct("10");
echo decoct("1587");
echo decoct("70");
?>

Output:

36
12
3063
106