Easy Tutorial
❮ Php Ajax Rss Reader Func Curl_Close ❯

PHP base_convert() Function

PHP Math Reference Manual

Example

Convert a hexadecimal number to an octal number:


Definition and Usage

The base_convert() function converts a number between arbitrary bases.


Syntax

Parameter Description
number Required. The number to convert.
frombase Required. The base of the number to convert from. Between 2 and 36, inclusive. Digits in numbers with a base higher than 10 will be represented with the letters a-z, where a means 10, b means 11, and z means 35.
tobase Required. The base to convert to. Between 2 and 36, inclusive. Digits in numbers with a base higher than 10 will be represented with the letters a-z, where a means 10, b means 11, and z means 35.

Technical Details

Return Value: The number converted to the specified base.
Return Type: String
--- ---
PHP Version: 4+
--- ---

More Examples

Example 1

Convert an octal number to a decimal number:

Example 2

Convert an octal number to a hexadecimal number:


❮ Php Ajax Rss Reader Func Curl_Close ❯