PHP decoct() Function

❮ PHP Math Reference

Example

Convert decimal to octal:

<?php
echo decoct("30") . "<br>";
echo decoct("10") . "<br>";
echo decoct("1587") . "<br>";
echo decoct("70");
?>
Try it Yourself »

Definition and Usage

The decoct() function converts a decimal number to an octal number.

Tip: To convert octal to decimal, look at the octdec() function.


Syntax

decoct(number);

Parameter Values

Parameter Description
number Required. Specifies the decimal value to convert

Technical Details

Return Value: A string that contains the octal number of the decimal value
Return Type: String
PHP Version: 4+

❮ PHP Math Reference
Copyright 1999-2023 by Refsnes Data. All Rights Reserved.