What PHP function can be used to calculate the age of a person based on their birthdate stored in a database?

To calculate the age of a person based on their birthdate stored in a database, you can use the PHP function `date_diff()` to find the difference between the current date and the birthdate. This function returns a DateInterval object which contains the years, months, and days between the two dates. You can then extract the years from the DateInterval object to get the person's age.

// Assuming $birthdate is the birthdate fetched from the database
$birthdate = new DateTime($row['birthdate']);
$currentDate = new DateTime();
$age = $birthdate->diff($currentDate)->y;

echo "The person's age is: " . $age;