Are there any best practices for optimizing the performance of DateTimeZone::getTransitions in PHP 7?

When using DateTimeZone::getTransitions in PHP 7, it is important to optimize the performance by minimizing unnecessary calls to this method. One way to achieve this is by caching the results of the method to avoid repeated calls. This can be done by storing the transitions in a variable and checking if it has already been fetched before making the method call.

$timezone = new DateTimeZone('America/New_York');

if (!isset($transitions)) {
    $transitions = $timezone->getTransitions();
}

// Use $transitions array as needed