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 The octal representation of the parameter. The maximum value that can be converted is decimal 4294967295, and the result is "37777777777".

Example

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

Output:

36
12
3063
106