Jump to content

Problem with hexdec


Tonic-_-

Recommended Posts

Hmm... Alright, I did this a few months ago, I reloaded the OS on my VPS and now I'm getting issues.

 

I'm converting a value like

 

110000120bfd99a from hex to decimal, it's suppose to return 76561198509709722, but instead, it's returning 7.656119850971E+16

 

Any ideas how to fix this? It's really starting to annoy me.. I use hexdec($value);

Like I said, it worked before I reloaded my OS now it just won't work :\

Link to comment
https://forums.phpfreaks.com/topic/245779-problem-with-hexdec/
Share on other sites

That number exceeds the maximum integer value for a 32 bit OS, so it's being represented exponentially. you could use number_format() to change the way it's displayed.

 

echo number_format(hexdec('110000120bfd99a'), 0, '', '');

Link to comment
https://forums.phpfreaks.com/topic/245779-problem-with-hexdec/#findComment-1262405
Share on other sites

That number exceeds the maximum integer value for a 32 bit OS, so it's being represented exponentially. you could use number_format() to change the way it's displayed.

 

echo number_format(hexdec('110000120bfd99a'), 0, '', '');

 

Ahh, I kind of thought it may have to be with the servers OS, I went from a 64-bit OS to a 32-bit OS.

 

I tried what you said, sadly it didn't return exactly what I wanted. Suppose I'll just have to reload it with 64-bit again or maybe make a API on a 64-bit OS to call it, thanks anyways :3

Link to comment
https://forums.phpfreaks.com/topic/245779-problem-with-hexdec/#findComment-1262434
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.