is_int and GET or POST

后端 未结 10 1271
傲寒
傲寒 2020-12-14 10:44

Why does is_int always return false in the following situation?

echo $_GET[\'id\']; //3
if(is_int($_GET[\'id\']))
    echo \'int\'; //not execut         


        
10条回答
  •  时光取名叫无心
    2020-12-14 10:54

    Because $_GET['id'] is a string like other parts of query string. You are not converting it to integer anywhere so is_int return false.

提交回复
热议问题