Let's suppose I have a div inside a foreach and inside that div I have another div with a class x, but I would like this class x to be numbered at each replay, is there such a possibility?
Code sample:
<?php
foreach ($list_menu as $key => $menu):
?>
<?php
if(count($menu->subMenu)):
?>
<li class="dropdown">
<a href="<?= base_url('categoria/' . $menu->txtUrlMenuSite); ?>"><?= strtolower($menu->txtMenu); ?></a>
<div class="dropdown-content">
<div class="col-xs-12">
<ul class="sub-nav">
<?php
foreach ($menu->subMenu as $key => $sub):
?>
<li><a href="<?= base_url('categoria/' . $sub->txtUrlMenuSite); ?>"><?= $sub->txtMenu; ?></a></li>
<?php
endforeach;
?>
</ul>
</div>
</div>
</li>
<?php
else:
?>
<li><a href="<?= base_url('categoria/' . $menu->txtUrlMenuSite); ?>"><?= strtolower($menu->txtMenu); ?></a></li>
<?php
endif;
?>
</li>
<?php
endforeach;
?>