ID: 27208 Updated by: [EMAIL PROTECTED] Reported By: tonyman_hacker at yahoo dot com -Status: Open +Status: Bogus Bug Type: Scripting Engine problem Operating System: Linux PHP Version: 4.3.4 New Comment:
Works fine on linux. php -r ' printf("%x\n", ~ 0x1); ' fffffffe Previous Comments: ------------------------------------------------------------------------ [2004-02-10 10:18:21] tonyman_hacker at yahoo dot com Description: ------------ I've founded that under Linux the ~ bit operator doesn't produce correct result; Reproduce code: --------------- $myvar = 0x1; $myvar = ~$myvar; // the result of this operation on windows system is correct // 0xFFFFFFFE // on Linux we have 0xFFFFFFFF echo dechex($myvar); Expected result: ---------------- // the result of this operation on windows system is correct // 0xFFFFFFFE // on Linux we have 0xFFFFFFFF Actual result: -------------- // the result of this operation on windows system is correct // 0xFFFFFFFE // on Linux we have 0xFFFFFFFF instead of this you could use XOR operator ... i.e. ~$myvar = $myvar ^ 0xFFFFFFFF ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=27208&edit=1