note 117712 added to function.crc32
| From: | Joey | Date: | Mon, 27 Jul 2015 12:59:25 +0000 |
| Subject: | note 117712 added to function.crc32 | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-203193@lists.php.net to get a copy of this message | ||
The manual is misleading.
> hash("crc32b", $str) will return the same string as dechex(crc32($str)).
hash("crc32b", $str) will **NOT** return the same string as dechex(crc32($str)).
Source: '9818479'
string(7) "d009e37"
string(8) "0d009e37"
Using the hash function is more portable and recommended.
hash("crc32b", $str) will return the same string as:
str_pad(dechex(crc32($str)), 8, '0', STR_PAD_LEFT)
----
Server IP: 72.52.91.14
Probable Submitter: 149.6.187.130
----
Manual Page -- http://php.net/manual/en/function.crc32.php
Edit -- https://master.php.net/note/edit/117712
Del: integrated -- https://master.php.net/note/delete/117712/integrated
Del: useless -- https://master.php.net/note/delete/117712/useless
Del: bad code -- https://master.php.net/note/delete/117712/bad+code
Del: spam -- https://master.php.net/note/delete/117712/spam
Del: non-english -- https://master.php.net/note/delete/117712/non-english
Del: in docs -- https://master.php.net/note/delete/117712/in+docs
Del: other reasons-- https://master.php.net/note/delete/117712
Reject -- https://master.php.net/note/reject/117712
Search -- https://master.php.net/manage/user-notes.php