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

Reply via email to