Home > php教程 > PHP源码 > php crc32

php crc32

PHP中文网
Release: 2016-05-23 08:39:48
Original
1243 people have browsed it

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

[PHP]代码   

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

                   

                   

Related labels:
php
source:php.cn
Statement of this Website
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
Latest Articles by Author
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template