What potential issue can arise when using the Date() function in PHP to calculate age based on birthdate?

The potential issue that can arise when using the Date() function in PHP to calculate age based on birthdate is that it may not account for leap years accurately. To solve this issue, you can use the DateTime class in PHP, which provides more accurate date calculations, including handling leap years correctly.

$birthdate = '1990-02-29'; // Leap year birthday
$today = new DateTime();
$diff = $today->diff(new DateTime($birthdate));
$age = $diff->y;
echo "Age: " . $age;