What are some potential pitfalls of using a pre-built HTML table class in PHP?

One potential pitfall of using a pre-built HTML table class in PHP is limited customization options. These classes may not allow for easy modification of the table structure or styling. To solve this, consider creating your own table generation function in PHP that gives you more control over the output.

function generateCustomTable($data) {
    $output = '<table>';
    
    foreach ($data as $row) {
        $output .= '<tr>';
        
        foreach ($row as $cell) {
            $output .= '<td>' . $cell . '</td>';
        }
        
        $output .= '</tr>';
    }
    
    $output .= '</table>';
    
    return $output;
}

// Example data
$data = [
    ['Name', 'Age'],
    ['John', 25],
    ['Jane', 30]
];

echo generateCustomTable($data);