title: How to create an array from a CSV file using PHP and the fgetcsv function
body: <p>Can someone kindly provide a code to create an array from a CSV file using fgetcsv?</p>
  
  <p>I've used the following code to create an array from a simple CSV file, but it doesn't work right when one of my fields has multiple commas - such as addresses.</p>
  
  <pre><code>$lines =file('CSV Address.csv');
  
  foreach($lines as $data)
  {
  list($name[],$address[],$status[])
  = explode(',',$data);
  }
  </code></pre>
  
  <p>*Also, str_getcsv is not supported by my hosting service.</p>
  
  <p>The above code doesn't work with the following CSV file example.  First column is name, second column is address, third column is marital status.</p>
  
  <pre><code>Scott L. Aranda,"123 Main Street, Bethesda, Maryland 20816",Single
  Todd D. Smith,"987 Elm Street, Alexandria, Virginia 22301",Single
  Edward M. Grass,"123 Main Street, Bethesda, Maryland 20816",Married
  Aaron G. Frantz,"987 Elm Street, Alexandria, Virginia 22301",Married
  Ryan V. Turner,"123 Main Street, Bethesda, Maryland 20816",Single
  </code></pre>