By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,206 Members | 1,020 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,206 IT Pros & Developers. It's quick & easy.

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

P: n/a
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
Share this Question
Share on Google+
1 Reply


P: n/a
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.