is_int and GET or POST

后端 未结 10 1290
傲寒
傲寒 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 11:14

    You can possibly try the intval() which can be used to test the value of your var. e.g

    If(intval($_GET['ID']==0)
    

    The function will check if the var is integer and return TRUE if not FALSE

提交回复
热议问题