Home > Article > Backend Development > The difference between is_int and is_numeric
is_int: It is a strong type judgment. When the parameter is a number of type int, return 1, otherwise return 0
is_numeric: It is a number/digit string (if it is a pure numeric string, if there are characters, it returns false ), return 1
example:
is_numeric(1234);//true
is_numeric('1234');//true
is_numeric ('1234e4');//false
is_numeric('1234 ');//false
So under normal circumstances, if the data passed from the front end is not forced to convert/int processing, it is best to use is_numeric(), which can ensure that the parameter judgment can pass
The above has introduced the difference between is_int and is_numeric, including the relevant aspects. I hope it will be helpful to friends who are interested in PHP tutorials.