How can I find last <td> in table with PHP
<p>I wonder how can i find out last  in table with PHP, aka if that  is last then i want to apply different style and content to it.</p>

<p>This is part of my code generating table content.</p>

<pre><code>  $content .= '&lt;/tr&gt;';

  $totalcols = count ($columns);
  if (is_array ($tabledata))
  {
    foreach ($tabledata as $tablevalues)
    {
      if ($tablevalues[0] == 'dividingline')
      {
        $content .= '&lt;tr&gt;&lt;td colspan="' . $totalcols . '" style="background-color:#efefef;"&gt;&lt;div align="left"&gt;&lt;b&gt;' . $tablevalues[1] . '&lt;/b&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;';
        continue;
      }
      else
      {
        $content .= '&lt;tr&gt;';
        foreach ($tablevalues as $tablevalue)
        {
          $content .= '&lt;td&gt;' . $tablevalue . '&lt;/td&gt;';
        }

        $content .= '&lt;/tr&gt;';
        continue;
      }
    }
  }
  else
  {
    $content .= '&lt;tr&gt;&lt;td align="center" style="border-bottom: none;" colspan="' . $totalcols . '"&gt;No Records Found&lt;/td&gt;&lt;/tr&gt;';
  }
</code></pre>

<p>I know there is option to do something like that with jQuery later on, but I don't want to complicate it and just solve it with php at time when i generate table.</p>
