How can PHP be used to calculate a person's age in days instead of years?

To calculate a person's age in days using PHP, you can subtract the person's birthdate from the current date and convert the result to days. This can be achieved by using the DateTime class in PHP to handle date calculations.

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

echo "Age in days: " . $ageInDays;