php - Username/ID Integer detection -


i trying detect if input users id or username. i've tried doing this

if (is_int($user)) {     echo "is int"; }else{     echo "is not"; } 

however isn't working, doesn't detect int if is. i've thought doing (int) $user if have username "example2" become 2 , become id 2 right?

you need use is_numeric

if(is_numeric($user)){         echo "is int";     }else{         echo "is not";     } 

Comments