Home >>PHP Math Functions >PHP decoct() Function
PHP decoct() function is used to return the octal equivalent of a given input decimal number. It accepts only a single parameter $number which is the decimal number whose octal equivalent is to be calculated. It returns a string representing the octal equivalent of the given decimal number passed as argument.
Syntax:
decoct($number);
Parameter | Description |
---|---|
number | This is a required parameter. This parameter defines the decimal value to convert. |
Here is an example of decoct() function in PHP:
<html> <body> <?php echo decoct("10")."<br>"; echo decoct("25")."<br>"; ?> </body> </html>
Here is an another example of decoct() function in PHP:
<html> <body> <?php echo decoct("7")."<br>"; echo decoct("67")."<br>"; echo decoct("253")."<br>"; echo decoct("1234")."<br>"; ?> </body> </html>