I am creating a table with zebra style in my view:-
$sr_no = 1;
if($sr_no % 2 == 0){
$style = 'class="even-row"';
}else{
$style = 'class="odd-row"';
}
<tr <?php echo $style?>>
$sr_no++;
Zend Framework provides this
echo $this->cycle(array("class='even-row'","class='odd-row'"))->next();
However, I think, behind the scenes it is doing the same as my code. So which one is Optimised?