excuse me for being dumb, but can you explain this line for me? if (! (++$i % 2))
i've done scripts like this before, but never used anything like this? but then i never was a great coder :) thanks ----- Original Message ----- From: "Don Read" <[EMAIL PROTECTED]> To: "Marius" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Sunday, March 30, 2003 1:54 PM Subject: RE: [PHP] question > > On 30-Mar-2003 Marius wrote: > > <?php > > $i = 0; > > $list = array('Banana', 'Strawberry', 'Apple', 'Cherry'); > > echo $list[$i]; > > $i = $i+1; > > ?> > > > > how to do that 2 of key echoes in first table colum and other 2 in > > second colum? > > > > Method 1: > > $i=0; > echo '<tr><td> > foreach($list as $v) { > > echo $v, '<br>'; > if (! (++$i % 2)) > echo '</td>'; > if ($i < count($list)) > echo '<td>'; > } > } > echo '</tr>'; > > > Method 2: > > echo '<tr>'; > unset($blk); > foreach($list as $v) { > if (count($blk) >= 2) { > echo '<td>', implode('<br>', $blk), '</td>'; > unset($blk); > } > $blk[] = $v; > } > > if (count($blk) ) > echo '<td>', implode('<br>', $blk), '</td>'; > echo '</tr>'; > > > Regards, > -- > Don Read [EMAIL PROTECTED] > -- It's always darkest before the dawn. So if you are going to > steal the neighbor's newspaper, that's the time to do it. > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php