Menu Samaritan's Purse

BASE_CONVERT

Convert a number between arbitrary bases

SYNTAX

base_convert ( string $number , int $frombase , int $tobase ) : string

PARAMETERS

number

The number to convert. Any invalid characters in number are silently ignored.

frombase

The base number is in

tobase

The base to convert number to

RETURN

number converted to base tobase

EXAMPLES

1

10000

2

0:0
1:1
2:10
3:11
4:100
5:101
6:110
7:111
8:1000
9:1001
10:1010
11:1011
12:1100
13:1101
14:1110
15:1111

3

0:0
1:1
2:2
3:3
4:4
5:5
6:6
7:7
8:10
9:11
10:12
11:13
12:14
13:15
14:16
15:17

4

0:0
1:1
2:2
3:3
4:4
5:5
6:6
7:7
8:8
9:9
10:a
11:b
12:c
13:d
14:e
15:f

PHP