I want to write a code but i want to do a
if ($username == (a number)) { this code } else { this code }
how would i see if $username is a number or not??
http://www.php.net/is_numeric
if(is_numeric($username)) { echo '$username is a number'; }else { echo '$username is not a number'; }
is_numeric() is one way, but it really depends on your definition of a number. You might consider [man]ctype_digit/man and [man]ctype_xdigit/man as well.