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);
 
crc32.txt · Last modified: 2008/04/18 14:00 (external edit)
 
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki