Possible Duplicate:
Load and read a csv file with php
I have the following string:
Mr,Tom,Jones,Add1,Add2,"Add3,Add3 extra",Town,County,postcode,99999,888,777
I am tring to get the string into an array that looks like the below:
Array
(
    [0] => Mr
    [1] => Tom
    [2] => Jones
    [3] => Add1
    [4] => Add2
    [5] => "Add3,Add3 extra"
    [6] => Town
    [7] => County
    [8] => Postcode
    [9] => 99999
    [10] => 888
    [11] => 777
)
if you explode the string by "," it splits array item 5 into 2 parts which I am trying to avoid. The original data comes from a CSV.
Ultimatly I am trying to import a CSV and create a new DB on the fly with the headers and file content against the correct headers.
Thanks in advance.
Try fgetcsv():
fgetcsv — Gets line from file pointer and parse for CSV fields
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With