Php 使用';下一个';在具有多个相对日期的时间内

Php 使用';下一个';在具有多个相对日期的时间内,php,strtotime,relative-date,Php,Strtotime,Relative Date,在查看了之后,我仍然对在strotime中进行减法时的多个相对日期的操作顺序感到困惑 我注意到以下返回值1/9/2015 strtotime('next friday -7 days', strtotime('1/16/2015')) strtotime('next friday +7 days', strtotime('1/16/2015')) 然而,以下回报2015年1月30日 strtotime('next friday -7 days', strtotime('1/16/2015')

在查看了之后,我仍然对在
strotime
中进行减法时的多个相对日期的操作顺序感到困惑

我注意到以下返回值1/9/2015

strtotime('next friday -7 days', strtotime('1/16/2015'))
strtotime('next friday +7 days', strtotime('1/16/2015'))
然而,以下回报2015年1月30日

strtotime('next friday -7 days', strtotime('1/16/2015'))
strtotime('next friday +7 days', strtotime('1/16/2015'))
我认为这是因为2015年1月16日是周五,下周五是2015年1月23日(与上文第二个strotime的工作原理类似)。然后我们将减去或加上七天


可以看出,减法似乎不是这样的。关于这些操作的顺序的更多说明。

重新编写代码,如下所示解决了问题(返回1/16/2015):


我仍然认为上面的措辞应该能够找到2015年1月16日的日期,所以我想当你使用StrotTime作为注释时,应该记住这一点,将其分为两个操作“下周五”和“-7天”,与“2015年1月16日”的输出类似。