Hi I have the following php foreach loop,
<?php
foreach ($row['row'] as $inrow) {
$slots_available = $inrow[2];
$cal_id = $inrow[3];
$selenable=true;
?>
<tr style="width: 100%;background: <?php if($slots_available=='H') echo "rgb(235,235,235)"; else echo 'white'; ?>;" class="tbody_vo_edit">
<td class="thc_vo tblb" width="200" style="border-left: 1px dotted #CFCFCF;font:11px verdana;color:#17375e;background: <?php if($slots_available=='H') echo "rgb(235,235,235)"; else echo 'white'; ?>;"><?= $inrow[0] ?></td>
<td class="thc_vo tblb" width="210" style="border-left: 1px dotted #CFCFCF;font:11px verdana;color:#17375e;background: <?php if($slots_available=='H') echo "rgb(235,235,235)"; else echo 'white'; ?>;"><?php if($slots_available=='H') echo ' '; else { echo $inrow[1]; } ?></td>
<td class="thc_vo tblb " width="140" style="font:11px verdana;color:#17375e;background: <?php if($slots_available=='H') echo "rgb(235,235,235)"; else echo 'white'; ?>;">
<div style="float:right;margin-top:-2px;display:<?php if($slots_available=='H') echo "none"; else echo 'block'; ?>">(<?=$users_occupied?>/<?=$slots_available?>)</div>
</td>
<td class="thc_vo tblb" style="width: 25%;min-width:141px;max-width:141px;padding:5px;background:<?php if($slots_available=='H') echo "rgb(235, 235, 235)"; else echo 'white'; ?>"><?php if($selenb){?><input style="display:none;" type="text" value="" class="tblinput"><?php }?></td>
</tr>
<?php
}
?>
On execution of this i got a table, in which i would like to compare the values of first ie.,$inrow[0] value with the second row first value. And i would like to add another tag if both the values are different. Can anyone help me how can i compare these values. For example : the table is as follows:
time | tasks | slots
05:00 am - 05:55 am | asdfas | 3
05:00 am - 05:55 am | asdasdfasdf | 4
From this table i want to compare the time values of first row and second row and if both are not equal i would like to add a row in the table between these two rows to say "next time slot" Thanks in advance..
forinstead offoreachto get access to previous/next indexes?