3

in php5, pass a 64bit integer, 1707541557936130 through GET, but it shows value of 1.7075415579361E+15

how can I force php to use large integers as integers, not as float

when I shift << apparently the result of that is int32 as well, not int64

is there a way to globally say use int64?

hakre
  • 193,403
  • 52
  • 435
  • 836
cc young
  • 18,939
  • 31
  • 90
  • 148
  • There is [GMP](http://php.net/manual/book.gmp.php) and there is [BC Math](http://php.net/manual/book.bc.php). At least GMP should help you here. – hakre Aug 01 '12 at 13:44

1 Answers1

4

PHP supports 64bit integers only on 64bit systems. In both cases integers, that are larger than PHP_INT_MAX, are converted to floats. see manual.

Try this code:

<?php
$i=1707541557936130;
var_dump($i);    
echo PHP_INT_MAX;
heiko
  • 444
  • 2
  • 3