|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2006-10-06 13:09 UTC] ivoras at yahoo dot com
Description:
------------
crc32() in PHP returns an integer larger than 2G on a 64-bit platform; It's documented, and applications rely on it, that it will return a signed integer from the range [-2G .. 2G]. The major problem with 64-bit crc32() here is that databases can't store the value in a column declared as INTEGER, thus braking compatibility.
Reproduce code:
---------------
echo crc32('10780');
Expected result:
----------------
-1171594808
Actual result:
--------------
3123372488
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 17:00:02 2025 UTC |
Use dechex(crc32('10780')) to get string value, which is the same on all architectures. The integer value differs because of obvious reasons.