Re: unsigned int



Marek Simon wrote:
I have mysql database for internal computer evidence and I store IP as unsigned numeric value. It is very good for computing network ranges and so on. But PHP do not support unsigned integer. So when I store values to doatabase, I must convert it to string with sprintf. When reading it, I get a string value with 10-digit number, bigger than maxint. I need to convert it to signed int and work with it as a number (for making binary arithmetics). I have discovered no way how to do it. Intval() or (int) type conversion returns maxint. Converting it in mysql is anoying too, because mysql cant do signed 32-bit int type conversion, only 64 bit.
Marek

I've just found something. intVal(floatVal($num));

Marek

.



Relevant Pages

  • Re: unsigned int
    ... But PHP do not support unsigned integer. ... I need to convert it to signed int and work with it as a number. ... Converting it in mysql is anoying too, because mysql cant do signed 32-bit int type conversion, only 64 bit. ...
    (comp.lang.php)
  • Re: sizeof A
    ... Because 'A' alone is an int. ... Single quotes in this context actually specify a type conversion, ... to the ASCII value of 'A'. ...
    (comp.lang.c)
  • Re: sizeof A
    ... Could you tell me why sizeof 'A' is taken as 4? ... Because 'A' alone is an int. ... Single quotes in this context actually specify a type conversion, ...
    (comp.lang.c)
  • Re: sizeof A
    ... Because 'A' alone is an int. ... Single quotes in this context actually specify a type conversion, ... No, the single quotes specify a charater constant, which is inherently ...
    (comp.lang.c)
  • Re: data converstion from long to int
    ... when the coversion takes place an exception error is thrown. ... maybe it isn't possible to convert a long to an int. ... You may want to use 'CInt' instead which will perform a type conversion. ...
    (microsoft.public.dotnet.languages.vb)