What are the best practices for sending data to a table in PHP, considering layout and responsiveness for different browser widths?

When sending data to a table in PHP, it is important to consider the layout and responsiveness for different browser widths. One way to achieve this is by using CSS to style the table and make it responsive by using media queries to adjust the layout based on the screen size. Additionally, you can use PHP to dynamically generate the table data and ensure it is displayed correctly on all devices.

<?php
// Sample PHP code to send data to a responsive table

// Data to be displayed in the table
$data = array(
    array('Name', 'Age', 'Country'),
    array('John Doe', 30, 'USA'),
    array('Jane Smith', 25, 'Canada'),
    array('Michael Johnson', 35, 'UK')
);

// Start the table
echo '<table>';

// Loop through the data array and output rows
foreach ($data as $row) {
    echo '<tr>';
    foreach ($row as $cell) {
        echo '<td>' . $cell . '</td>';
    }
    echo '</tr>';
}

// End the table
echo '</table>';
?>