What best practices should be followed when working with timezones in PHP to avoid discrepancies in time calculations?

When working with timezones in PHP, it is important to always set the correct timezone using the `date_default_timezone_set()` function to avoid discrepancies in time calculations. Additionally, it is recommended to use the `DateTime` class for date and time manipulations as it handles timezones more effectively than traditional date functions.

// Set the default timezone to UTC
date_default_timezone_set('UTC');

// Create a new DateTime object with the current time
$currentTime = new DateTime();

// Set the timezone for the DateTime object
$currentTime->setTimezone(new DateTimeZone('America/New_York'));

// Display the current time in the specified timezone
echo $currentTime->format('Y-m-d H:i:s');