将输入转换为32位无符号整数,若溢出,则只保留低32位
May 25, 2016 pm 05:09 PMfunction uint32val($var) { if (is_string($var)) { if (PHP_INT_MAX > 2147483647) { $var = intval($var); } else { $var = floatval($var); } } if (!is_int($var)) { $var = intval($var); } if ((0 > $var) || ($var > 4294967295)) { $var &= 4294967295; if (0 > $var) { $var = sprintf('%u', $var); } } return $var; }
Copy after login
以上就是将输入转换为32位无符号整数,若溢出,则只保留低32位的内容,更多相关内容请关注PHP中文网(www.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

Hot Article
Repo: How To Revive Teammates
3 weeks ago
By 尊渡假赌尊渡假赌尊渡假赌
How Long Does It Take To Beat Split Fiction?
3 weeks ago
By DDD
R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
1 weeks ago
By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks ago
By 尊渡假赌尊渡假赌尊渡假赌

Hot tools Tags

Hot Article
Repo: How To Revive Teammates
3 weeks ago
By 尊渡假赌尊渡假赌尊渡假赌
How Long Does It Take To Beat Split Fiction?
3 weeks ago
By DDD
R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
1 weeks ago
By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks ago
By 尊渡假赌尊渡假赌尊渡假赌

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Disabling Win11 Input Experience Guide
![Windows input encounters hang or high memory usage [Fix]](https://img.php.cn/upload/article/000/887/227/170835409686241.jpg?x-oss-process=image/resize,m_fill,h_207,w_330)
Windows input encounters hang or high memory usage [Fix]

Use the strconv.ParseUint function to convert a string to an unsigned integer and return an error message

C program to input an array of sequences of integers separated by spaces

Implementing unsigned integer recovery division algorithm in C++

PHP Practice Guide: How to determine if the input contains only numbers and letters
