Home  >  Article  >  php教程  >  php crc32

php crc32

PHP中文网
PHP中文网Original
2016-05-23 08:39:481202browse

32位系统 或者 32位的php.exe 最大int整数是 var_dump(PHP_INT_MAX) =>  int(2147483647)
crc32函数返回无符号32位整数, 所以赋值给变量可能溢出成负数。
解决方法,返回值转为字符串。 sprintf("%u", crc32($str))

[PHP]代码   

 <?php
    sprintf("%u", crc32($str));
 ?>

                   

                   

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn