PHP function crc32()

by Rekha 2010-01-28 18:16:42

This function is used to calculate the crc32 polynomial of a string.

syntax:
int crc32 ( string $str )

It generates the cyclic redundancy checksum polynomial of 32-bit lengths of the str . This is usually used to validate the integrity of data being transmitted.

Because PHP's integer type is signed, and many crc32 checksums will result in negative integers, you need to use the "%u" formatter of sprintf() or printf() to get the string representation of the unsigned crc32 checksum.

Example:
<?php
$checksum = crc32("The quick brown fox jumped over the lazy dog.");
printf("%u\n", $checksum);
?>

Tagged in:

910
like
0
dislike
0
mail
flag

You must LOGIN to add comments