What is the common practice for generating tables in PHP using variables for height and width?

When generating tables in PHP using variables for height and width, the common practice is to use nested loops to iterate over the rows and columns of the table. By using variables for the height and width, you can easily control the size of the table dynamically. This approach allows for more flexibility and scalability in generating tables with varying dimensions.

<?php
// Define variables for table height and width
$tableHeight = 5;
$tableWidth = 3;

// Generate table with specified height and width
echo '<table border="1">';
for ($i = 0; $i < $tableHeight; $i++) {
    echo '<tr>';
    for ($j = 0; $j < $tableWidth; $j++) {
        echo '<td>Row ' . ($i + 1) . ', Col ' . ($j + 1) . '</td>';
    }
    echo '</tr>';
}
echo '</table>';
?>