title: Using PHP to display random line of CSV by column
body: <p>I want to pick a random line out of a CSV file and display it, while also being able to add style through css/html. Ideally I could set each key (of the randomly chosen row) to display separately (as to be styled).</p>
  
  <p>Activity, description, step 1, step 2, step 3, comments</p>
  
  <p>could display as</p>
  
  <p><strong>Activity</strong> <br/>
  <em>Description</em><br/>
  - step 1 <br/>
  - step 2 <br/>
  - step 3 <br/>
  <strong>comments</strong></p>
  
  <p>I've been using the following code, but i cant break the values out to style them separately.</p>
  
  <pre><code>&lt;? 
  
  $sep=","; // separator 
  $mycsv=file("hopper-01.csv"); 
  $row=rand(0,count($mycsv)-1); 
  $data=explode($sep,$mycsv[$row]); 
  
  $num = count ($data); 
  
  for ($c=0; $c &lt; $num; $c++) { 
    print $data[$c] . "&lt;br&gt;"; 
  } 
  
  ?&gt;
  </code></pre>