title: problem with PHP reading CSV files
body: <p>I'm trying to read data from a.csv file to ouput it on a webpage as text.</p>
  
  <p>It's the first time I'm doing this and I've run into a nasty little problem.</p>
  
  <p>My .csv file(which gets openened by Excel by default), has multiple rows and I read the entire thing as one long string.</p>
  
  <p>like this:</p>
  
  <pre><code>$contents = file_get_contents("files/data.csv");
  </code></pre>
  
  <p>In this example file I made, there are 2 lines.</p>
  
  <blockquote>
    <p>Paul  Blueberryroad
    85    us  Flashlight,Bag  November 20,
    2008, 4:39 pm</p>
    
    <p>Hellen    Blueberryroad
    85    us  lens13mm,Flashlight,Bag,ExtraBatteries  November
    20, 2008, 16:41:32</p>
  </blockquote>
  
  <p>But the string read by PHP is this:</p>
  
  <p>Paul;Blueberryroad 85;us;Flashlight,Bag;November 20, 2008, 4:39 pmHellen;Blueberryroad 85;us;lens13mm,Flashlight,Bag,ExtraBatteries;November 20, 2008, 16:41:32</p>
  
  <p>I'm splitting this with:</p>
  
  <pre><code>list($name[], $street[], $country[], $accessories[], $orderdate[]) = split(";",$contents);
  </code></pre>
  
  <p>What I want is for $name[] to contain "Paul" and "Hellen" as its contents. And the other arrays to receive the values of their respective columns.</p>
  
  <p>Instead I get only Paul and the content of $orderdate[] is</p>
  
  <blockquote>
    <p>November 20, 2008, 4:39 pmHellen</p>
  </blockquote>
  
  <p>So all the rows are concatenated. Can someone show me how i can achieve what I need?</p>
  
  <p>EDIT: solution found, just one werid thing remaining:</p>
  
  <p>I've solved it now by using this piece of code:</p>
  
  <pre><code>$fo = fopen("files/users.csv", "rb+");
  while(!feof($fo)) {
    $contents[] = fgetcsv($fo,0,';');
  }
  fclose($fo);
  </code></pre>
  
  <p>For some reason, allthough my CSV file only has 2 rows, it returns 2 arrays and 1 boolean. The first 2 are my data arrays and the boolean is 0.</p>