PHP decoct() Function

Definition

The decoct() function converts a decimal number into an octal number. It takes just one parameter, which is the number to convert.

Syntax

PHP decoct() Function has the following format.

string decoct ( int num )

Parameter

ParameterIs Required Description
numRequired. Decimal value to convert

Return

Item Description
Return Value A string that contains the octal number of the decimal value
Return Type String

Note

To convert octal to decimal, use the octdec() function.

Example

Convert decimal to octal:


<?php/*from  w  w  w. ja v a2  s. c o m*/
echo decoct("30") . "\n";
echo decoct("10") . "\n";
echo decoct("17") . "\n";
echo decoct("70") . "\n";
print decoct(19); // "23"   
?>

The code above generates the following result.





















Home »
  PHP Tutorial »
    Function reference »




PHP Array Functions
PHP Calendar Functions
PHP Class Functions
PHP Data Type Functions
PHP Date Functions
PHP File Functions
PHP Image Functions
PHP Math Functions
PHP MySQLi Functions
PHP SimpleXML Functions
PHP String Functions
PHP XML Functions
PHP Zip Functions