PHP bitwise AND (&) returns negative number
问题 The code: echo (5243960811416 & 4040906070209050); Try on http://phptester.net/ and the result (right) will be 20407554584 but on my web hosting it gives -1067281896 . There's any workaround to have 20407554584 ? It's a 32bit limit? Thanks UPDATE /w SOLUTION 回答1: SOLUTION After searchs and searchs I found this and I re-convert in PHP function BitwiseAndLarge($val1, $val2) { $shift = 0; $result = 0; $mask = ~((~0) << 30); // Gives us a bit mask like 01111..1 (30 ones) $divisor = 1 << 30; // To