How does PHP handle time zones for users accessing a website from different locations?

When users access a website from different locations, PHP can handle time zones by setting the default time zone for the script using the `date_default_timezone_set()` function. This function allows you to specify a time zone that will be used for all date and time functions in the script, ensuring that users see times displayed in their local time zone.

// Set the default time zone to the user's time zone
date_default_timezone_set('America/New_York');

// Now all date and time functions will use the 'America/New_York' time zone
echo date('Y-m-d H:i:s'); // Display the current date and time in the user's time zone