PHP crc32() Function

You are Here:

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); ?>

Output

2160385429

Syntax

crc32(str)

Parameter Values

ValueTypeExplanation
strRequiredSpecifies a string to generate a 32-bit cyclic redundancy code (CRC).

Return Value

ValueExplanation
IntegerReturns the crc32 checksum of the given string.

Reminder

Hi Developers, we almost covered 90% of String functions and Interview Question on PHP with examples for quick and easy learning.

We are working to cover every Single Concept in PHP.

Please do google search for:

Join Our Channel

Join our telegram channel to get an instant update on depreciation and new features on HTML, CSS, JavaScript, jQuery, Node.js, PHP and Python.

This channel is primarily useful for Full Stack Web Developer.

Share this Page

Meet the Author