title: How to increment a number inside foreach loop?
body: <p>I want to fetch some data from database and show it in the form of HTML table.</p>
  
  <p>I want the first column of the table to show the number of row like 1,2,3,4...</p>
  
  <p>This is my foreach loop</p>
  
  <pre><code>$i=0;    
  foreach($sql as $sql)    
  {
      echo "&lt;tr&gt;";
          echo "&lt;td&gt;$i++&lt;/td&gt;";
          echo "&lt;td&gt;$sql-&gt;jobseeker_name&lt;/td&gt;";
          echo "&lt;td&gt;$sql-&gt;jobseeker_phone&lt;/td&gt;";
          echo "&lt;td&gt;$sql-&gt;login_email&lt;/td&gt;";
      echo "&lt;/tr&gt;";
  }
  </code></pre>
  
  <p>It is not working and I don't know what is wrong with it.</p>