+ 1

help php

Hello everybody! I am learning PHP and I have created a calendar as per the desired one. But I have an error on line 25 because the $ week array does not have '6'. I can not adjust it. tnks https://code.sololearn.com/w5l9y45YXaDe/?ref=app

2nd Oct 2018, 10:45 AM
Luiz Felipe Gonçalves
Luiz Felipe Gonçalves - avatar
4 Antworten
+ 2
Use CSS for styling the table columns. Put this on top of document before <h1> <style> td {text-align:center;} td.weekend {color:red;font-weight:bold;} td.today {color:blue;font-weight:bold;} </style> Here I fixed the "line" function, this will create an empty column when a certain array element isn't set. function line($week) { echo '<tr>'; $today = date('d'); for ($i = 0; $i <= 6; $i++){ if(!isset($week[$i])){ echo '<td>&nbsp;</td>'; continue; } if ($week[$i] == $today){ echo "<td class='today'>$week[$i]</td>"; } else if ($i == 0 or $i == 6){ echo "<td class='weekend'>$week[$i]</td>"; } else{ echo "<td>$week[$i]</td>"; } } echo '</tr>'; }
3rd Oct 2018, 3:51 PM
Ipang
+ 1
Ipang I already checked and it is ok. Later I will study the points to learn. thank you so much!
3rd Oct 2018, 4:44 PM
Luiz Felipe Gonçalves
Luiz Felipe Gonçalves - avatar
+ 1
You're most welcome Luiz Felipe Gonçalves : )
3rd Oct 2018, 4:47 PM
Ipang
0
basic problem
3rd Oct 2018, 9:24 AM
Esontomor (B170910031)
Esontomor (B170910031) - avatar