title: PHP fgetcsv display specific columns only
body: <p>I'm using the code below (from a previous post) to pull from an csv file but I'd like to just display specific columns.  I've already tried to modify using other solutions with no avail. Any help would be much appriciated.</p>
  
  <pre><code>&lt;?php 
  function jj_readcsv($filename, $header=false) {
  $handle = fopen($filename, "r");
  echo '&lt;table width="400" border="1" bordercolor="#666666" cellspacing="0" cellpadding="2"&gt;';
  //display header row if true
  if ($header) {
      $csvcontents = fgetcsv($handle);
      echo '&lt;tr&gt;';
      foreach ($csvcontents as $headercolumn) {
      echo "&lt;th&gt;$headercolumn&lt;/th&gt;";
  }
  echo '&lt;/tr&gt;';
  }
  // displaying contents
  while ($csvcontents = fgetcsv($handle)) {
      echo '&lt;tr&gt;';
      foreach ($csvcontents as $column) {
         echo "&lt;td&gt;$column&lt;/td&gt;";
      }
      echo '&lt;/tr&gt;';
  }
  echo '&lt;/table&gt;';
  fclose($handle);
  }
  ?&gt;
  </code></pre>
  
  <p>HEADER1 | HEADER2 | HEADER3<br>
  COLUMN1 | COLUMN2 | COLUMN3<br>
  COLUMN1 | COLUMN3 | COLUMN3<br></p>
  
  <p>Summary: I just want to display 1&amp;2</p>