I am using for loop and have some issue. Below is the example:
<tr>
<td class="tg-031e">3:00</td>
<?php for ($i=0; $i < $total_staff; $i++) {
$chk = $this->general_model->check_for_temp_color('3:00', $selected_dt);
?>
<td class="tg-031e text-right availablepopup"></td>
<?php } ?>
</tr>
Now let say, $chk value can be one of this: 1 or 2. If it is 1 then assign class only for i==1, if it is 2 then assign class where i==1 and i==2.
Hope this is clear for understanding!
$chkvariable outside the loop?$chkon first iteration, then do it before the loop.$chkreturns 1 or 2, if 1 then add class only for first iteration otherwise for all iteration. this is i want.