PHP 在 while 循环中将 date('Y-m-d', strtotime(x days')) 减少 (x-1)

PHP decreasing date('Y-m-d', strtotime(x days')) by (x-1) in while loop

我正在尝试减少此日期函数中的计数器变量 (x):

date('Y-m-d', strtotime(x days'))

在这样的 while 循环中:

$Today = date('Y-m-d', strtotime('-1 days'));

到目前为止的输出:2015-06-25

$x = -1;

while ($row = mysql_fetch_array($result1)) {

$Today = date('Y-m-d', strtotime('$x days'));

... 

$x = $x - 1;
}

while 循环下一次迭代的期望输出:2015-06-24 等等...

除了必须使用双引号字符串来插入变量外,您已经拥有的一切都可以使用,如 strtotime("$x days") – @Michael Berkowski