Home > Backend Development > PHP Tutorial > PHP determines whether the data from FORM is an integer

PHP determines whether the data from FORM is an integer

WBOY
Release: 2016-07-29 09:00:56
Original
1174 people have browsed it

The is_int function has no way to determine whether the data coming from FORM is an integer, because the data coming from FORM is a string. Use is_numeric to determine whether it is a numeric type, and with a little effort you can determine whether it is an integer

if(!is_numeric($jp_total)||strpos($jp_total,".")!==false){
    echo "不是整数";
}else{
    echo "是整数";
}
Copy after login

The above introduces how PHP determines whether the data from FORM is an integer, including aspects of it. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template