0

I have a 128 character hex string.

I need to get the first 5 characters and then convert them to a decimal, which I will do with hexdec()

How can I get the first 5 characters?

Artjom B.
  • 61,146
  • 24
  • 125
  • 222
user112927
  • 23
  • 1
  • 4

2 Answers2

0

1)use substr to get 5 digits

$value = substr($yourstring, 0, 5);

look into exammple

2)Then convert them to decimal

Community
  • 1
  • 1
codelover
  • 317
  • 1
  • 11
0

try

$decvalue = hexdec(substr($the_string, 0, 5));
Javad
  • 4,339
  • 3
  • 21
  • 36