- explode: documentation ( source)
- checkdate: documentation ( source)
<?php
$startDate = '2014-01-01';
$endDate = '2014-12-31';
$startDateParts = explode('-', $startDate);
$endDateParts = explode('-', $endDate);
if (!checkdate($startDateParts[1], $startDateParts[0], $startDateParts[2]) ||
!checkdate($endDateParts[1], $endDateParts[0], $endDateParts[2])) {
echo 'Invalid date ranges';
} else {
echo 'GTG!';
}