fgetcsv() defaults to using a "
as an enclosure character, but you can change this to another different character (e.g. a tilde ~
) that isn't used anywhere in your data; then the "
won't be misinterpreted
while(($data=fgetcsv($handle,5000,'|','~'))!==false){