How can the script be modified to display a static numbering on the left side of the table?

To display a static numbering on the left side of the table, you can add a counter variable that increments for each row in the table. This counter can be displayed in a separate column on the left side of the table. By initializing the counter before the loop and incrementing it within the loop, you can ensure that each row is numbered sequentially.

<table>
  <tr>
    <th>#</th>
    <th>Name</th>
    <th>Age</th>
  </tr>
  <?php
  $counter = 1;
  foreach ($data as $row) {
    echo "<tr>";
    echo "<td>" . $counter . "</td>";
    echo "<td>" . $row['name'] . "</td>";
    echo "<td>" . $row['age'] . "</td>";
    echo "</tr>";
    $counter++;
  }
  ?>
</table>