Table of Contents

Syntax

int crc32(string $str)

(PHP 4 >= 4.01, PHP 5)

$str Source text or binary string for the CRC calculation.
RETURNS Cyclical Redundancy Checksum as an integer value.

What it Does

Use this method to calculate the Cyclical Redundancy Check (checksum) for string or binary data. The result is a signed integer, if you want to convert it to signed, you will need to convert the result using sprintf as shown in the example below.

Example

// calulate the checksum from a form post
$chksum = crc32($_POST['body']);
echo sprintf('The checksum is: %u', $chksum);