3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $months = array( "Януари", "Февруари", "Март", "Април", "Май", "Юни", "Юли", "Август", "Септември", "Октомври", "Ноември", "Декември" ); $days_in_month = array( 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ); $current_month_index = date("n") - 1; ?> <html> <body> <table> <tr> <td colspan="2"><a href="#"><?php echo $months[$current_month_index - 1] ?></a></td> <td colspan="3"><?php echo $months[$current_month_index] ?></td> <td colspan="2"><a href="#"><?php echo $months[$current_month_index + 1] ?></a></td> </tr> <tr> <td>Понеделник</td> <td>Вторник</td> <td>Сряда</td> <td>Четвъртък</td> <td>Петък</td> <td>Събота</td> <td>Неделя</td> </tr> <tr> <?php for ($i = 1; $i <= $days_in_month[$current_month_index]; $i++) { ?> <?php if ($i % 7 === 1) { ?> <td></td> <td></td> <?php } ?> <td><?php echo $i ?></td> <?php } ?> </tr> </table> </body> </html>
Output for 4.3.0 - 7.1.0
<html> <body> <table> <tr> <td colspan="2"><a href="#">Септември</a></td> <td colspan="3">Октомври</td> <td colspan="2"><a href="#">Ноември</a></td> </tr> <tr> <td>Понеделник</td> <td>Вторник</td> <td>Сряда</td> <td>Четвъртък</td> <td>Петък</td> <td>Събота</td> <td>Неделя</td> </tr> <tr> <td></td> <td></td> <td>1</td> <td>2</td> <td>3</td> <td>4</td> <td>5</td> <td>6</td> <td>7</td> <td></td> <td></td> <td>8</td> <td>9</td> <td>10</td> <td>11</td> <td>12</td> <td>13</td> <td>14</td> <td></td> <td></td> <td>15</td> <td>16</td> <td>17</td> <td>18</td> <td>19</td> <td>20</td> <td>21</td> <td></td> <td></td> <td>22</td> <td>23</td> <td>24</td> <td>25</td> <td>26</td> <td>27</td> <td>28</td> <td></td> <td></td> <td>29</td> <td>30</td> <td>31</td> </tr> </table> </body> </html>