I have an array like this:
Array
(
[0] => Array
(
[date] => 2012-11-29
[description] => Work Done
[hours] => 1.0
[id] => 6502
[person-id] => 8853
[project-id] => 8928
[todo-item-id] => 122353
[person-name] => Jane Doe
)
[1] => Array
(
[date] => 2012-11-29
[description] => Work Done 2
[hours] => 1.0
[id] => 6502
[person-id] => 8853
[project-id] => 8928
[todo-item-id] => 122353
[person-name] => Jane Doe
)
[2] => Array
(
[date] => 2012-11-28
[description] => Work Done 3
[hours] => 1.0
[id] => 6502
[person-id] => 8853
[project-id] => 8928
[todo-item-id] => 122353
[person-name] => Jane Doe
)
Etc.
I want to display this information in a table grouped by Date. I'm using foreach to get each of the values but I'm trying to figure out how to examine if the date is the same in each array and only echo the date once if so. This is what I've got so far...
<table>
<tbody>
<?php
foreach($time as $log){
//tried this but it doesn't work
//if(array_unique($log['date'])){
echo '<thead>
<tr class="info">
<td colspan="3">'.$log[date].'</td>
</tr>
</thead>';
//};
echo "<tr>";
echo "<td>{$log['todo-item-id']}</td>";
echo "<td>{$log['description']}</td>";
echo "<td>{$log['hours']}</td>";
echo "</tr>";
} ?>
</tbody>
</table>