Re: Looping through array
| From: | Ashley M. Kirchner | Date: | Thu, 16 Nov 2006 20:31:03 +0000 |
| Subject: | Re: Looping through array | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-244745@lists.php.net to get a copy of this message | ||
Brad Bonkoski wrote:
Something like this perhaps... $arr = array(...); $per_row = 5; $elem = count($arr); for($i=0; $i<$elem; $i++) { if( $i == 0 )-- W | It's not a bug - it's an undocumented feature. +-------------------------------------------------------------------- Ashley M. Kirchner <mailto:ashley@pcraft.com> . 303.442.6410 x130 IT Director / SysAdmin / Websmith . 800.441.3873 x130 Photo Craft Imaging . 3550 Arapahoe Ave. #6 http://www.pcraft.com ..... . . . Boulder, CO 80303, U.S.A.echo "<tr>";else if( $i % $per_row == 0 )echo "</tr><tr>";echo "<td>$arr[$i]</td>"; } That simply displays things in order, 1 through 5, then 6 through 10.