title: How to change one particular column's background color when importing data from a CSV
body: <p>I am importing CSV data into a HTML table using <a href="https://stackoverflow.com/questions/518795/dynamically-display-a-csv-file-as-an-html-table-on-a-web-page">this</a> solution. Right now the table has 7 columns (but the number of rows will vary from 20-60 time to time). My client asked me to change the 5th column's background color to something else so that one particular column stands out from the rest. How can I do that?</p>
  
  <p>My code:</p>
  
  <pre><code> &lt;?php
   $f = fopen("so-csv.csv", "r");
   while (($line = fgetcsv($f)) !== false) {
      echo "&lt;tr&gt;";
      foreach ($line as $cell) {
         echo "&lt;td&gt;" . htmlspecialchars($cell) . "&lt;/td&gt;";
      }
      echo "&lt;/tr&gt;\n";
   }
   fclose($f);
   ?&gt;
  </code></pre>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Thank you <strong>roullie</strong> &amp; <strong>Ghost</strong> for your quick responses! However, I forgot to mention that my client wants the table to have 2 colors, e.g. if all the columns are red, only the 5th one will be gray. So I had...</p>
  
  <pre><code>foreach ($line as $cell) {
    echo '&lt;td style="background-color: #892525;"&gt;' . htmlspecialchars($cell) . '&lt;/td&gt;';
  }
  </code></pre>
  
  <p>Now how can I add your solution to this? </p>