title: PHP explode for CSV?
body: <p>I have data in a CSV file.  I need to read the file and put the data into an array.  I have 5 columns in my CSV file, like this:</p>
  
  <pre><code>CAPRICCIOSA | Tomato, Cheese, Mushrooms | $8.00 | $12.00 | $15.00
  
  MARGHERITA  | Tomato, Cheese, Oregano   | $7.00 | $11.00 | $13.00
  </code></pre>
  
  <ol>
  <li><p>How can I<code>explode()</code> it into array?  If I use a comma to explode it into array, it will become <code>CAPRICCIOA - Tomato - Cheese</code> because my text already has a comma.</p></li>
  <li><p>How can I split it into different rows, like MySQL so I can loop through the results?</p></li>
  </ol>
  
  <p>I have tried the following:</p>
  
  <pre><code> $file="dish.csv" ;
   $file=file_get_contents($file);
   $array=explode(",", $file);
  </code></pre>