Cara memberi nomer otomatis pada Foreach Loop PHP



Ini dia contohnya :

<?php 
$n = 0;
foreach ($_productCollection as $_product): 
$n++;
?>
<div style="float: left; font-size: 120px;height:50px;padding-top:50px; color:#ccc"><?php echo $n; ?>
</div>
<div class="listing-item<?php if( ++$_iterator == sizeof($_productCollection) ): ?> last<?php endif; ?>">
Smoga bermanfaat....

Previous
Next Post »