$ms = microtime(true);
$ts = $ms * 10;
$i = substr($ts, 0,strpos($ts, "."));
echo " A: ". $ms;
echo " B: ". $ts;
echo " C: ". $i;
echo " D: ". intval($i);
echo " E: ". (int)$i;
example:
A: 1382292940.8799
B: 13822929408.799
C: 13822929408
D: 2147483647
E: 2147483647
But
E =/= C && D =/= C
Why does this happen?
The problem you are having is an overflow one. 32-bit integers hold up to 4 billion and some unsigned and only 2 billion and some signed. The number you are converting to an integer is much larger than that:
13,822,929,408
Hence you are seeing 2147483647, the limit for a 32-bit signed integer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With