Complete PHP Math Reference
The base_convert() function converts a number from one base to another.
| Parameter | Description |
|---|---|
| number | Required. Original value |
| frombase | Required. Original base of number. Frombase has to be between 2 and 36, inclusive. Digits in numbers with a base higher than 10 will be represented with the letters a-z, with a meaning 10, b meaning 11 and z meaning 35. |
| tobase | Required. The base to convert to. Tobase has to be between 2 and 36, inclusive. Digits in numbers with a base higher than 10 will be represented with the letters a-z, with a meaning 10, b meaning 11 and z meaning 35. |
Convert an octal number to a decimal number:
The output of the code above will be:
Convert an octal number to a hexadecimal number:
The output of the code above will be:
Complete PHP Math Reference
Your message has been sent to W3Schools.