$ Now parameter in php function strtotime ()

I am trying to understand what the $ now parameter does in php functions

strtotime (string $ time [, int $ now = time ()])

Everyone seems to just ignore the $ now option, and the documentation for it is not very clear.

How does this parameter really affect the return value?

+4
source share
1 answer

This is an optional parameter for unix timestamps. If used, the current clock used in the function will be $now ; otherwise, the current timestamp will be used.

For example, if you enter yesterday, if you did not add an optional parameter, it assumes that you really really mean yesterday. If you added timetamp within 1 week ago, it will give you an answer yesterday week ago.

+4
source

Source: https://habr.com/ru/post/1440244/


All Articles