How to Use crc32() String Function in PHP?

Definition & Usage

The crc32() function calculates a 32-bit CRC (cyclic redundancy checksum) for a string.This function can be used to validate data integrity.The crc32() function returns the crc32 checksum of string as an integer.

Syntax

crc32(str)

Example

The following is an example :-

<!DOCTYPE html>
<html>
<body>
<?php
$str = crc32("Experts PHP!");
printf("%u\n",$str);
?> 
</body>
</html>
//Output - 2386188324

Example 2–

<!DOCTYPE html>
<html>
<body>
<?php
$str = crc32("Best Tutorials Website!");
printf("%u\n",$str);
?> 
</body>
</html>