for($i=0; $i<4; $i++)
{
$monthArr[] = date("Y-m-d H:i:s", strtotime('2011-10-31'. -1*$i.' month'));
}
Result:
Array
(
[0] => 2011-10-31
[1] => 2011-10-01 //Here should be 2011-09-30
[2] => 2011-08-31
[3] => 2011-07-31
)
I would like the output like the following, Thanks!
Array
(
[0] => 2011-10-31
[1] => 2011-09-30
[2] => 2011-08-31
[3] => 2011-07-31
)
etc.