function datevalidation($value) { // value should be year-month-day $today = strtotime("today"); $value = strtotime($value); if ($value >= $today) { return true; } else { return false; } } Why it doesn't return true? if (datevalidation("2007-12-8")) { echo "ok"; }