Why date() works twice as fast if we set time zone from code?

后端 未结 2 1921
深忆病人
深忆病人 2020-12-09 07:47

Have you noticed that date() function works 2x faster than usual if you set actual timezone inside your script before any date() c

2条回答
  •  北荒
    北荒 (楼主)
    2020-12-09 08:42

    I'd imagine it has to determine the timezone for itself each time it's called unless explicitly specified, which adds to the function runtime.

    But really, does it matter? How many scripts are you likely to make that call date() 100,000 times per run?

提交回复
热议问题