PHP crc32 Function

What is crc32 Function?

Explanation

In PHP, this function is used to calculate the cyclic redundancy checksum polynomial of a string.

Syntax:


crc32(string)

In the above syntax "string" is the input for which crc32 polynomial to be found, its usually 32-bit's in length for the given string, and its used to validate the integrity of data being transmitted.

Example :


<?php
$str = crc32("Hey how are you!");
printf ("%u",$str);
printf ($str);
?>
Result :

4193096734
-101870562

In the above example the "u%" fomatter is used to get the correct result, otherwise it may display negative numbers.

PHP Topics


Ask Questions

Ask Question