Hi guys,
I have one simple logical question that I seem not to figure it out, sadly...
We have a list of objects and I loop trough them, list of products.
We need to create anchor maps for each category, so I did a comparison with temp variables to check the previous and current element value.
How can I display only the first occurence of a series of values for each category ?
Desired result:
Category 1
- product 1
- product 2
- product 3
Category 2
- product 1
- product 2
- product 3
$previous = '';
if(!empty($promotii)) {
foreach($promotii as $promotie) {
$previous = $promotie->Marca;
}
$previous = $promotie->Marca;
}