Question

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?

Was it helpful?

Solution

try

$decvalue = hexdec(substr($the_string, 0, 5));

OTHER TIPS

1)use substr to get 5 digits

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

look into exammple

2)Then convert them to decimal

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top