This code snippet validate user input from a form :
$year=strip_tags($year);
if(empty($$year) || is_numeric($year) || strlen($year)!=4 || $year
- strip all html tags ( handle by strip_tags )
- make sure the year in 4 digit (with strlen help)
- make sure its number not character (is_numeric)
- not empty (php empty function)
- force user enter year of birth not less than 1970
More information about those function, read php manual or search from php.net