decoct()
regantewksbury12 total contributions
Published Nov 10, 2023
Contribute to Docs
The decoct()
function takes a given decimal number and returns a string
version of the corresponding octal value. An octal value is from the base-8
numerical system, which only uses eight digits: zero through seven. For 32-bit platforms, 4294967295
is the largest number that can be computed. For 64-bit platforms, 9223372036854775807
is the largest number that can be computed.
Syntax
decoct($number);
number
: The decimal to convert.
Example
This example uses the decoct()
function to convert a decimal to its octal value:
<?phpecho decoct("30");?>
The above example will result in the following output:
36
Codebyte Example
The following Codebyte example can be run and calls the decoct()
method two times. The first call uses the maximum value that can be converted for a 32-bit platform.
Looking to contribute?
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.