PHP Tutorial - PHP crc32() Function






The crc32() function calculates a 32-bit CRC (cyclic redundancy checksum) for a string.

Syntax

PHP crc32() Function has the following syntax.

crc32(string)

Parameter

string is the value we want to convert.

Example

The following code prints the result of crc32().


<?php
$str = crc32("java2s.com");
printf("%u\n",$str);
?>

We have to use %u to format the result.

The code above generates the following result.