Facebook Page Twitter Page LinkedIn Page
× PHP Tutorial PHP Advanced PHP Resources


The PHP Math octdec() function returns the decimal number equivalent to the octal number represented by the octal string argument.

Syntax

octdec(oct_string)

Parameters

oct_string Required. Specify the octal number to convert.

Return Value

The decimal representation of a octal string argument.

Example:

In the example below, octdec() function returns the decimal representation of a octal string argument.

<?php
$x = '777'; 
$y = 111;
$z = 765;

echo "octdec($x) returns: ".octdec($x)."\n";
echo "octdec($y) returns: ".octdec($y)."\n";
echo "octdec($z) returns: ".octdec($z)."\n";
?>

The output of the above code will be:

octdec(777) returns: 511
octdec(111) returns: 73
octdec(765) returns: 501

❮ PHP Math Functions

5