PHP octdec() Function
In this chapter you will learn:
- Definition for PHP octdec() Function
- Syntax for PHP octdec() Function
- Parameter for PHP octdec() Function
- Return for PHP octdec() Function
- Example - Convert octal to decimal
Definition
The octdec()
function converts an octal number into a decimal number.
Syntax
PHP octdec() Function has the following format.
number octdec ( string octal_string )
Parameter
Parameter | Is Required | Description |
---|---|---|
octal_string | Required. | Octal string to convert |
Return
Item | Description |
---|---|
Return Value | The decimal value of octal_string |
Return Type | Float / Integer |
Example
Convert octal to decimal:
<?php/* jav a 2s . c om*/
print octdec("23");
echo octdec("36") . "\n";
echo octdec("12") . "\n";
echo octdec("303") . "\n";
echo octdec("10");
?>
The code above generates the following result.
Next chapter...
What you will learn in the next chapter:
- Definition for PHP pi() Function
- Syntax for PHP pi() Function
- Parameter for PHP pi() Function
- Return for PHP pi() Function
- Example - Get the value of PI
Home » PHP Tutorial » PHP Math Functions