How To Add Odd/Even Loop In Array Using PHP?
There are many ways to add odd/even loop in array using PHP. The most common and easy one I often use is the one below. With the help of following code, I can alternate the color of divs or tables or cell using odd and even classe.
Ref: http://stackoverflow.com/a/15876816
$class = 'odd'; for(.........) # no problem what kind of loop you are using(for,foreach,while,do) { $class = ($class == 'even' ? 'odd' : 'even'); #some code }
Ref: http://stackoverflow.com/a/15876816
Nice blog and very informative thank you for sharing us.
ReplyDeleteRazorse Software