I'm needing help with an exercise in php that I'm doing. I'm getting the following error message:
Notice: Undefined offset: 1 in C: \ xampp \ htdocs \ calendario.php on line 5
You receive the same error message for lines 5 through 10 of the code. These lines refer to the screen printing of the values that should be in a vector. From the error message, it looks like the vector did not receive the correct values.
The following code is integrated:
<?php
function linha($semana){
echo "<tr>
<td>{$semana[0]}</td>
<td>{$semana[1]}</td>
<td>{$semana[2]}</td>
<td>{$semana[3]}</td>
<td>{$semana[4]}</td>
<td>{$semana[5]}</td>
<td>{$semana[6]}</td>
</tr>";
}
function calendario(){
$dia=1;
$semana=array();
while($dia<=31){
array_push($semana, $dia);
if(count($semana)==7);{
linha($semana);
$semana=array();
}
$dia++;
}
}
?>
<table border="1">
<tr>
<th>Dom</th>
<th>Seg</th>
<th>Ter</th>
<th>Qua</th>
<th>Qui</th>
<th>Sex</th>
<th>Sáb</th>
</tr>
<?php calendario();?>
</table>