The example #2 of the PHP manual page of the dechex()
function is the following :
// The output below assumes a 32-bit platform.
// Note that the output is the same for all values.
echo dechex(-1)."\n";
echo dechex(PHP_INT_MAX * 2 + 1)."\n";
echo dechex(pow(2, 32) - 1)."\n";
The above example will output:
ffffffff
ffffffff
ffffffff
I am trying to reproduce that behaviour on a x64 system :
echo dechex(-1)."\n";
echo dechex(PHP_INT_MAX * 2 + 1)."\n";
echo dechex(pow(2, 64) - 1)."\n";
I am expecting :
ffffffffffffffff
ffffffffffffffff
ffffffffffffffff
But, I get :
ffffffffffffffff
0
0
Any idea in what's going on here?