Last active
August 29, 2015 14:10
-
-
Save creativenucleus/86eb30b68ce9cc34fd74 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// crc32 can give different results on 32 bit and 64 bit machines running PHP. | |
// If you have legacy stored CRC32 values to match against, this will convert them. | |
$crc32 = crc32($value); | |
if(PHP_INT_SIZE == 8) { | |
// recast to 32 bit CRC on 64 bit machines... | |
if($crc32 > 0x7FFFFFFF) { // Negative bit is set | |
$crc32 -= 0x100000000; | |
} | |
} | |
echo $crc32; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment