PHP crc32() Function
Complete PHP String Reference
Definition and Usage
The crc32() function calculates a 32-bit CRC (cyclic redundancy checksum) for
a string.
This function can be used to validate data integrity.
Syntax
| Parameter |
Description |
| string |
Required. The string to be calculated |
Tips and Notes
Tip: To ensure that you get the correct string
representation from the crc32() function, you'll need to use the %u
formatter of the printf() or sprintf() function. If the %u formatter is not used, the result
may display
in incorrect and negative numbers.
Example 1
In this example we will print the result of crc32() with and without the "%u"
formatter (note that the result is equal):
<?php
$str = crc32("Hello world!");
echo 'Without %u: '.$str."<br />";
echo 'With %u: ';
printf("%u",$str);
?>
|
The output of the code above will be:
Without %u: 461707669
With %u: 461707669
|
Example 2
In this example we will print the result of crc32() with and without the "%u"
formatter (note that the result is not equal):
<?php
$str = crc32("Hello world.");
echo 'Without %u: '.$str."<br />";
echo 'With %u: ';
printf("%u",$str);
?>
|
The output of the code above will be:
Without %u: -1959132156
With %u: 2335835140
|
Complete PHP String Reference
 |
 |
 |
 |
The Ektron Intranet
lets you do everything you need to do on your corporate intranet and everything you want to do... all with just one application.
What can you do with the Ektron Intranet? |
 |
Navigate through content, documents, assets, colleagues and workgroups quickly and intuitively with enterprise search |
 |
Communicate with friends and colleagues with forums, message boards and corporate blogging using the new Social Networking Platform |

|
Utilize the extensive out-of-the box features or customize your site through Ektron CMS400.NET's open architecture |
 |
Promote collaboration in your organization through project workspaces where others can efficiently find information and work together |
 |
Author/edit content, manage navigation, menus, audit trails, workflow and approvals with the best in breed Content Management |
|
|
|
|
See why there are 20,000+ Ektron integrations worldwide.
|
|
 |
TAKE THE VIDEO TOUR |
 |
or download a FREE TRIAL today. |
|