How can the width of a table be fixed to prevent it from collapsing when the browser is resized in PHP?

To prevent a table from collapsing when the browser is resized, you can set a fixed width for the table using CSS. This will ensure that the table maintains its size regardless of the browser window size. You can achieve this by adding a style attribute to the table tag or by using an external CSS file.

echo '<table style="width: 100%;">';
echo '<tr>';
echo '<td>Cell 1</td>';
echo '<td>Cell 2</td>';
echo '</tr>';
echo '</table>';