I need a list which iterates through the months and always shows the last days like this
2015-04-30
2015-03-31
2015-02-28
...
My idea was to do this with the strtotime method, where '1430344800' is the timestep according to 2015-04-30
$time_temp = 1430344800;
echo date('Y-m-t',$time_temp)."<br>";
$time_temp = strtotime("-1 month",$time_temp);
echo date('Y-m-t',$time_temp)."<br>";
$time_temp = strtotime("-1 month",$time_temp);
echo date('Y-m-t',$time_temp)."<br>";
but I just get
2015-04-30
2015-03-31
2015-03-31
replacing 'Y-m-t' by 'Y-m-d' gives
2015-04-30
2015-03-30
2015-03-02
Why is it not reducing the month properly and how can I accomplish it?