468,306 Members | 1,120 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,306 developers. It's quick & easy.

convert 16-byte hex "string" to dec in php

Hi.
I have a string, 16 bytes long, representing a hex number.
I need to convert it to a number and put it into pgsql database; it
complicates the matters further cause pgsql doesn't support unsigned;
thus I have to subtract "magic" number (half the bigint range) from
the conversion result to put it into pgsql.

Is there any way to achieve this?

Apr 8 '07 #1
1 4784
You could try this function to convert a very large value from hex to
decimal:

http://us.php.net/manual/en/ref.bc.php#25336

It uses the bcmath arbitrary precision functions.

On Apr 8, 2:53 pm, "Sergei Shelukhin" <realg...@gmail.comwrote:
Hi.
I have a string, 16 bytes long, representing a hex number.
I need to convert it to a number and put it into pgsql database; it
complicates the matters further cause pgsql doesn't support unsigned;
thus I have to subtract "magic" number (half the bigint range) from
the conversion result to put it into pgsql.

Is there any way to achieve this?

Apr 9 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

19 posts views Thread by Lauren Quantrell | last post: by
1 post views Thread by Logan X via .NET 247 | last post: by
2 posts views Thread by Joel Moore | last post: by
3 posts views Thread by Convert TextBox.Text to Int32 Problem | last post: by
7 posts views Thread by patang | last post: by
6 posts views Thread by patang | last post: by
reply views Thread by Teichintx | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.