What are potential pitfalls when using strtotime and DateTime functions in PHP for age verification?

When using strtotime and DateTime functions in PHP for age verification, a potential pitfall is not taking into account time zones, which can lead to inaccurate age calculations. To solve this issue, it is important to set the correct time zone before performing any date calculations.

// Set the default time zone to ensure accurate date calculations
date_default_timezone_set('UTC');

// Example code for age verification using strtotime and DateTime functions
$birthdate = '1990-05-15';
$age = date_diff(new DateTime($birthdate), new DateTime('today'))->y;

if ($age >= 18) {
    echo 'You are old enough.';
} else {
    echo 'You are not old enough.';
}