Php crc32
From w3cyberlearnings
Contents |
PHP function crc32
This function calculates the crc32 (cyclic redundancy checksum) of a string. This function can be
used to check for data integrity.
Check for additional knowledge: http://en.wikipedia.org/wiki/Cyclic_redundancy_check
Syntax crc32
- string: string input
crc32(string);
Note
You need to use sprintf() or printf() functions for correctly formating the string representation from crc32() function.
Example 1
<?php $checksum = crc32('Great'); printf("%u<br/>", $checksum); ?>
Output
2287336795
Example 2
<?php $checksum = crc32('Great'); echo dechex($checksum); echo "<br/>"; echo hexdec(dechex($checksum)); echo "<br/>"; printf("%u<br/>", $checksum); ?>
Output
8855fd5b 2287336795 2287336795