What is the scope in date_default_timezone_set in PHP?

What is the scope in date_default_timezone_set in PHP?

I mean, if I use:

function foo() { date_default_timezone_set('valid string'); /* where valid string is a valid date_default_timezone_set parameter */ echo (date('bla bla')); } 

after using foo (), will the dates return to the normal / timezone by default?

+4
source share
1 answer

No, scope is the lifetime of the script executable. Usually you call date_default_timezone_set once (when you initialize the script), and then just forget about it.

+7
source

All Articles