octdec() function in PHP



The octdec() function converts octal to decimal.

Syntax

octdec(val)

Parameters

  • val − the octal string to convert

Return

The octdec() function Returns the decimal equivalent of the specified octal number.

Example

 Live Demo

<?php
   echo octdec("-120");
?>

Output

a80

Example

Let us see another example −

 Live Demo

<?php
   echo octdec("170");
   echo octdec(decoct(170));
?>

Output

120170
Updated on: 2019-12-27T06:57:16+05:30

68 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements