Jump to content

Read CSV line into an array


The Little Guy

Recommended Posts

how can I split a string into an array using a comma as the delimiter, BUT if the comma is between two quotes (double/single) don't split.

 

Basically I am reading a CSV file, and and I want an array of values for the row, but some rows have commas in the string, such as an address.

 

Example:

"Billly Bob","My, House"

 

Should give an array like so:

[0] => "Billy Bob",
[1] => "My, House"

Link to comment
https://forums.phpfreaks.com/topic/242865-read-csv-line-into-an-array/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.