code:
$x = 0xFFFFFF00;
printf("%08x %08x\n",$x,~$x);
output:
ffffff00 7fffffff
That's not quite what one would expect, is it? That kind of unreasonable and unexplainable behavior makes me hate PHP even more than before.
Update: you need to explicitly cast $x to int before doing the bitwise negation. *gna*.
$x = 0xFFFFFF00;
printf("%08x %08x\n",$x,~(int)$x);