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
WBOYOriginal
2016-07-29 09:00:561175browse

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 "是整数";
}

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.

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