total have 30 duck when to display 6 duck on each row

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Lphp
Forum Commoner
Posts: 74
Joined: Sun Jun 26, 2011 9:56 pm

total have 30 duck when to display 6 duck on each row

Post by Lphp »

total have 30 ducks when to display 6 ducks on each row
How to
User avatar
twinedev
Forum Regular
Posts: 984
Joined: Tue Sep 28, 2010 11:41 am
Location: Columbus, Ohio

Re: total have 30 duck when to display 6 duck on each row

Post by twinedev »

5 rows display have ducks
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: total have 30 duck when to display 6 duck on each row

Post by Christopher »

Check the modulus of the counter and the row width:

Code: Select all

for ($i=0; $i<30; ++$i) {
    if (($i % 6) == 0) {
        // new row
    }
    // show column
}
(#10850)
Lphp
Forum Commoner
Posts: 74
Joined: Sun Jun 26, 2011 9:56 pm

Re: total have 30 duck when to display 6 duck on each row

Post by Lphp »

Christopher wrote:Check the modulus of the counter and the row width:

Code: Select all

for ($i=0; $i<30; ++$i) {
    if (($i % 6) == 0) {
        // new row
    }
    // show column
}
Thank you :)
Post Reply