Note: This article reprinted http://www.manongjc.com/article/499.html
The PHP crc32 function is used to generate a string of 32-bit cyclic redundancy check code polynomial. This is typically used to check the integrity of the data being transmitted. This article introduces you to the basic syntax of PHP CRC32 functions and the use of examples. Need to the code farmers can refer to.
CRC32 function computes a crc32 polynomial of a string
Basic syntax for CRC32 functions
CRC32 string $str )
Generates a 32-bit cyclic redundancy check code polynomial for str. This is typically used to check the integrity of the data being transmitted.
Tip: To ensure that the correct string representation is obtained from the CRC32 () function, you need to use the%u format of the printf () or sprintf () function. If you do not use the%u format, the results may appear as incorrect numbers or negative values.
CRC32 parameter Introduction
Parameters |
Description |
String |
Necessary. The data to validate. |
CRC32 return value
Returns the integer of the str crc32 checksum.
CRC32 Function Example:
The second line in the example shows how to use the printf () function to convert a checksum:
$checksum = crc32 ("The quick brown fox jumped over the the lazy Dog.") printf ("%u\n", $checksum );
Run online
Operation Result:
2191738434
The above describes the PHP Crc32 computing string 32-bit CRC (cyclic redundancy check), including the aspects of the content, I hope to be interested in PHP tutorial friends helpful.