Year Validation with PHP

This code snippet validate user input from a form :


if(empty($$year) || is_numeric($year) || strlen($year)!=4 || $year

  1. strip all html tags ( handle by strip_tags )
  2. make sure the year in 4 digit (with strlen help)
  3. make sure its number not character (is_numeric)
  4. not empty (php empty function)
  5. force user enter year of birth not less than 1970

More information about those function, read php manual or search from