I am parsing a CSV data feed sent to me via php. I am turning each line into an array of values.
Here is my code:
$fp = fopen('data.txt','r');
while (!feof($fp))
{
$line = mysql_real_escape_string(fgets($fp));
$value_array = explode(',', $line);
}
But if one of the lines looks like this:
"some company, inc.",XC34ET,500
I am getting 4 values:
"some company
inc."
XC34ET
500
When I really want these 3 values:
some company, inc.
XC34ET
500
How can I update my script to account for this?