I have a graph, which shows stats for the latest 7 days. They are shown like this:
Today - 17-09 - 16-09 - 15-09 - 14-09 - 13-09 - 12-09
The PHP looks like this:
$days = array('Today');
for ($i = 1; $i < 7; $i++) {
$days[$i] = date('d-m', strtotime('-' . ($i + 0) . ' day'));
}
My question is, how can I do so it will look like this:
12-09 - 13-09 - 14-09 - 15-09 - 16-09 - 17-09 - Today
Thanks in advance.
Try this:
$days = array_reverse($days);
Otherwise you can generate it in reverse order:
$days = array();
for ($i=6; $i>=1;$i--)
{
$days[] = date('d-m', strtotime('-'.($i+0).' day'));
}
$days[] = 'Today';