PHP 中的 crc32() 函数
phpprogrammingserver side programming更新于 2025/11/20 10:20:00
crc32() 函数用于计算 32 位 CRC。您可以使用该函数来验证数据完整性。
语法
crc32(str)
参数
str − 字符串
返回
crc32() 函数以整数形式返回字符串的 crc32 校验和。
示例
下面是一个例子 −
<?php
$res = crc32("This is demo text!");
printf("%u
", $res);
?>
输出
2903462745
示例
让我们看另一个例子 −
<?php
$s = crc32("Welcome!");
echo 'First:'.$s."
";
printf("Second: %u
", $s);
?>
输出
First: 893564114 Second: 893564114

