What are some common methods used in PHP to calculate a person's age based on their birthdate?

To calculate a person's age based on their birthdate in PHP, you can use the DateTime class to get the current date and the birthdate, calculate the difference between the two dates, and then extract the years from the difference.

$birthdate = new DateTime('1990-05-15');
$currentDate = new DateTime();
$age = $currentDate->diff($birthdate)->y;

echo "The person is $age years old.";