I am posting numeric value by a form and in php file use var_dump(is_int($my_var)); but it return bool(false) though i am posting 1 and if I use var_dump(is_int(1)); it is fine and return bool(true)
what is wrong….?
I am posting numeric value by a form and in php file use var_dump(is_int($my_var));
Share
Variables transmitted by a POST request are strings, so you’re calling
is_int()on a string which returns false.You may use
is_numeric()orfilter_var()instead or simply cast your variable to an integer.