crc32() function in PHP || PHP crc32 function

crc32() function in php

Last Updated by Pooja Chikara 27-Apr-20

0 348


PHP crc32() function is used to generate a 32-bit CRC for a given string. Here CRC refers to cyclic redundancy checksum. It is an inbuilt function of PHP.

Syntax:

crc32($string);

here,

$string is a PHP string.

To print the result by this function we can use either printf() or sprint() functions.

Note: To get the error-free correct string you should use %u formatter of the printf() and sprint() function.


Example:

<?php
$string="Ram's son goes to his school in the morning.";
$crc_string=crc32($string);
printf("%u",$crc_string);
?>

Output:

crc32() function in php


Share:


Leave a Reply


Comments
    Waiting for your comments