crc32()

crc32() — Calculates the crc32 polynomial of a string.

Built-in function of PHP 8.5. The manual lists it as available in PHP 4 >= 4.0.1, PHP 5, PHP 7, PHP 8. This page is the reference card: signature, parameters and return value, plus the changelog and the example the manual provides.

What it does

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

Signature

crc32(string $string): int

Parameters

ParameterTypeWhat it takes
$stringstringThe data.

Return value

Returns the crc32 checksum of string as an integer.

Example

A runnable snippet:

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

See also

hash(), md5(), sha1()

All PHP 8.5 built-in functions

Reference card built from the PHP manual page crc32() (PHP documentation, CC BY 3.0). The page is generated from the manual, so the wording of the parameter and return value text follows php.net.