Php integer overflow problem today I am writing a program and found that the inserted MYSQL data is inconsistent with the POST debugging and found that it is an error during data conversion. for example, if I want to convert a mobile phone number to an int, the mobile phone number is any character. if it is not a mobile phone number, it is easier to use intval before false, such as if (intval ('000000 '))... then proceed & nbsp; to find the ec php integer overflow problem
Today, I wrote a program and found that the inserted MYSQL data is inconsistent with the POST data. debugging found that it was an error during data conversion.
For example, if I want to convert a mobile phone number to an int, if the phone number is any character and not a mobile phone number, intval is used before false.
For example
If (intval ('000000 '))
... And then proceed
Found
Echo intval ('000000'); this sentence is not equal to 13688017729
My PDO is doing this. let me see how to fix this BUG.
------ Solution --------------------
You cannot do this! The mobile phone number is out of the integer range.
Check whether all the numbers are composed of is_numeric functions or regular expressions.
------ Solution --------------------
The error occurs because the database length overflows, not because of your type conversion. if you want to store the mobile phone number, you can change the field type to bigint.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.