PHP decoct()Functions
Examples
Convert decimal to octal:
<?php
echo decoct("30") . "<br>";
echo decoct("10") . "<br>";
echo decoct("1587") . "<br>";
echo decoct("70");
?>
echo decoct("30") . "<br>";
echo decoct("10") . "<br>";
echo decoct("1587") . "<br>";
echo decoct("70");
?>
Run example »
Definition and Usage
The decoct() function converts a decimal number to an octal number.
Tip:To convert octal to decimal, look at theoctdec()function.
Syntax
decoct(number);
| Parameters | Description |
|---|---|
| number | Required. Specifies the decimal value to convert. |
Technical Details
| Return value: | A string containing the octal representation of the decimal value. |
|---|---|
| Return type: | String |
| PHP Version: | 4+ |
PHP Math Reference Manual Other Extensions