$field) { if ($headers == null || in_array($name, $headers)) { $cols .= td($field); } } $rows .= tr($cols); $cols = ''; } else { $rows .= tr(td($row)); } } foreach ($headers as $name => $header) { $th .= th($header); } return table( thead($th) . tbody($rows), "class='" . $classes['table'] . "'" ); } }