How to make the table displayed:

1 колонка 2 колонка и так 12 колонок

(Январь date("dmY")) Февраль date("dmY")

01.01.2017

02.01.2017 , etc.

so i get an array (day month year)

 $begin = mktime(0, 0, 0, 1, 1, date("Y")); $end = mktime(0, 0, 0, 12, date("t"), date("Y")); $days = array(); for($i = $begin; $i <= $end; $i += 86400) { $days[] = date("dmY", $i); } 

And it’s impossible to insert into the table so that the months would be displayed in columns so that the new month would be displayed in the next column

<table> <tr> <?php foreach ($days as $day) { ?> <td><?php echo $day?></td> <?php } ?> </tr> </table>

So it turns out all in one column

    1 answer 1

     // начинаем с 1-го января $start = strtotime(date("Y") . '-1-1'); $month = []; for ($i=1; $i<=12; $i++) { // Узнаем число дней в месяце $dayInMonth = date("t", $start); // Заполняем массив днями $month[$i] = range(1, $dayInMonth); // а в хвост до 31 дописываем &nbsp; $month[$i] += array_fill($dayInMonth, 31-$dayInMonth, '&nbsp;'); // первое число следующего месяца $start = strtotime('next month', $start); } 

    I hope that the cycle of outputting a table of 12 arrays of the same length you write yourself