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

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Sergei Shelukhin

    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?

  • petersprc

    #2
    Re: convert 16-byte hex "string&qu ot; to dec in php

    You could try this function to convert a very large value from hex to
    decimal:



    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?

    Comment

    Working...