Phpcrc32 calculates the 32-bit CRC of a string (cyclic redundancy check)

Source: Internet
Author: User
Tags crc32
: This article mainly introduces the 32-bit CRC (cyclic redundancy check) of the phpcrc32 string. if you are interested in the PHP Tutorial, refer to it. Note: This article reprinted http://www.manongjc.com/article/499.html

The php crc32 function is used to generate a 32-bit cyclic redundancy checkcode polynomial of a string. This is usually used to check whether the transmitted data is complete. This article introduces the basic syntax and examples of php crc32 functions. For more information about the coders, see.

Crc32 function compute the crc32 polynomial of a string

Basic crc32 function syntax

int crc32 ( string$str )

Generate the 32-bit cyclic redundancy checksum polynomial of str. This is usually used to check whether the transmitted data is complete.

Tip: to ensure that the correct string representation is obtained from the crc32 () function, you need to use the % u format character of the printf () or sprintf () function. If % u is not used, the result may be displayed as an incorrect number or a negative number.

Crc32 parameters

Parameters Description
String Required. The data to be verified.

Crc32 return value

Returns the str crc32 verification integer.

Crc32 function instance:

The second line in the example demonstrates how to use the printf () function to convert the verification code:

  

Online operation

Running result:

2191738434

The above introduces the 32-bit CRC (cyclic redundancy check) of the php crc32 string calculation, including the content, and hope to be helpful to friends who are interested in the PHP Tutorial.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.