PHP crc32() Function

Last Updated:

PHP crc32()

The crc32() function generates the cyclic redundancy checksum (CRC) polynomial of 32-bit lengths of the given string.

This function is usually used to validate the integrity of data being transmitted.

Note: This function may return negative integers on 32bit platforms as PHP's integer type is signed. So you need to use the "%u" formatter of sprintf() or printf() to convert the crc32() result to an unsigned integer.

Example

PHP Compiler
<?php $str = crc32("Php world"); printf("%u\n", $str); ?>

Syntax

crc32(str)

Parameter Values

ValueTypeExplanation
str Required Specifies a string to generate a 32-bit cyclic redundancy code (CRC).

Return Value

ValueExplanation
Integer Returns the crc32 checksum of the given string.

Share this Page

Meet the Author