Easily Create A Table In PHP

Here is a small PHP snippet to easily create a table in PHP.

First create the draw_table function.

$rows = 10; // amout of tr 
$cols = 10;// amjount of td 
function drawTable($rows, $cols){
echo "<table border='1'>"; 

    echo "<tr>"; 
               echo "<td align='center'>".$tr*$td."</td>"; 
    echo "</tr>"; 

echo "</table>";

To draw the table on your page use the function we just created.

drawTable(30, 10);

This will create a table with 30 rows and 10 columns.

Advertise here 50% Off