Revision: 13533
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at April 27, 2009 09:06 by level09
Initial Code
function column_display($items,$numcols) {
$numitems = count($items);
// Number of Rows
$numrows = ceil($numitems/$numcols);
$output = '<table>';
for ($row=1; $row <= $numrows; $row++)
{
$cell = 0;
$output .= ' <tr>'."\n";
for ($col=1; $col <= $numcols; $col++)
{
$output .= ' <td>'."\n";
if ($col===1)
{
$cell += $row;
$output .= $items[$cell - 1]->name;
}
else {
$cell += $numrows;
$output .= $items[$cell - 1]->name;
}
$output .= ' </td>'."\n";
}
$output .= ' </tr>'."\n";
}
$output .= '</table>';
return $output;
}
Initial URL
Initial Description
Initial Title
PHP Display Arrays in Columns
Initial Tags
php
Initial Language
PHP