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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.