22 lines
553 B
PHP
22 lines
553 B
PHP
|
<?php
|
||
|
|
||
|
namespace Insallah;
|
||
|
|
||
|
class Table
|
||
|
{
|
||
|
public static function get($rows, $class = '', $fill = false)
|
||
|
{
|
||
|
$c = '';
|
||
|
$max_rows = sizeof(max($rows));
|
||
|
|
||
|
|
||
|
foreach ($rows as $row) {
|
||
|
if ($fill && sizeof($row) < $max_rows) {
|
||
|
$row = array_merge($row, array_fill(0, $max_rows - sizeof($row), ''));
|
||
|
}
|
||
|
$c .= '<tr><td>' . implode('</td><td>', $row) . '</td></tr>';
|
||
|
}
|
||
|
|
||
|
return (!empty($class) ? "<table class='$class'>" : '<table>') . $c . '</table>' . PHP_EOL;
|
||
|
}
|
||
|
}
|