Skip to content

Instantly share code, notes, and snippets.

@Abbe98
Created May 19, 2014 19:36
Show Gist options
  • Save Abbe98/13ba2c8b45ebd13be532 to your computer and use it in GitHub Desktop.
Save Abbe98/13ba2c8b45ebd13be532 to your computer and use it in GitHub Desktop.
$date = '2014-10-20';
list($yyyy, $mm, $dd) = explode('-', $date);
if (!checkdate($mm, $dd, $yyyy)) {
echo 'Error: date';
}
$time = '00:00:00';
if (!preg_match('/\d{2}\:\d{2}\:\d{2}/', $time)) {
echo 'Error: time';
}
$distance = '00,0';
if (!preg_match('/\d{2},\d/', $distance)) {
echo 'Error: distance';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment