note 113079 added to function.crc32
| From: | rasmus at mindplay dot dk | Date: | Tue, 27 Aug 2013 14:51:05 +0000 |
| Subject: | note 113079 added to function.crc32 | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-196094@lists.php.net to get a copy of this message | ||
Your best bet for consistent behavior across 32/64-bit platforms (and Windows) is the lowest common
denominator: force the return value of crc32() into a signed 32-bit integer, e.g.:
var_dump(unpack('l', pack('l', crc32('123456789_00_0'))));
This looks idiotic, but it gives you a consistent signed integer value on all platforms.
(that's a lower-case "L" for both arguments, if that happens looks like the number
"1" on your screen.)
----
Server IP: 192.41.42.26
Probable Submitter: 68.70.61.119
----
Manual Page -- http://php.net/manual/en/function.crc32.php
Edit -- https://master.php.net/note/edit/113079
Del: integrated -- https://master.php.net/note/delete/113079/integrated
Del: useless -- https://master.php.net/note/delete/113079/useless
Del: bad code -- https://master.php.net/note/delete/113079/bad+code
Del: spam -- https://master.php.net/note/delete/113079/spam
Del: non-english -- https://master.php.net/note/delete/113079/non-english
Del: in docs -- https://master.php.net/note/delete/113079/in+docs
Del: other reasons-- https://master.php.net/note/delete/113079
Reject -- https://master.php.net/note/reject/113079
Search -- https://master.php.net/manage/user-notes.php