I'm using mainly one check... subtracting 18 years to 2009 would be 1991, so any user should have a born date below 1991 to access
www.example.com. That conditional isn't dynamic, to adjust the code would be:
$min_year = date('Y', time());
$min_year = $min_year - 18; // Change this (minimum age)
if($year < $min_year){
...
But, I prefer to use 19 years on the first condition, due to I want to make a more refined checking for users whose born date is near to the year limit. In that case, I use
strtotime() to discount years and generate a timestamp, then I compare the user timestamp (date to seconds from 1970) with the subtracted timestamp obtained from today.
You cannot use only
strtotime() to check age because only will work with a date above 1970. For that reason, two checks.
Also, if you want to adjust the minimal age, change the value inside
strtotime()