Get a persons age from their birthdate

I’ve found this function to be the most accurate for calculating a persons age (knowing their birthdate).

function getAge_3($date) {
  return intval(substr(date('Ymd') - date('Ymd', strtotime($date)), 0, -4));
}

Source: http://spyk3lc.blogspot.com/2012/03/php-get-age-comparison-results-of-3.html

Scroll to Top