Menu Riverview Church

DECHEX

Decimal to hexadecimal

SYNTAX

dechex ( int $number ) : string

PARAMETERS

number

The decimal value to convert. As PHP's integer type is signed, but dechex() deals with unsigned integers, negative integers will be treated as though they were unsigned.

NEGATIVE DECIMAL POSITIVE DECIMAL HEXADECIMAL
0 0
1 1
2 2
... ...
9223372036854775806 7ffffffffffffffe
9223372036854775807 (largest signed integer) 7fffffffffffffff
-9223372036854775808 9223372036854775808 8000000000000000
... ... ...
-2 18446744073709551614 fffffffffffffffe
-1 18446744073709551615 (largest unsigned integer) ffffffffffffffff

RETURN

Hexadecimal string representation of number.

EXAMPLES

1

0

2

1

3

2

4

7ffffffffffffffe

5

7fffffffffffffff

6

8000000000000000
8000000000000000

7

fffffffffffffffe
0

8

ffffffffffffffff
0

PHP