I am reading content from a csv. I want to replace the single and double quotes from the data. I have tried the following code but is not working.
$resource = fopen($this->csv_file, 'r');
while (($data = fgetcsv($resource, 10000, ',')) !== false) {
$custom = $data[10];
$custom = str_replace('"', 'in',$custom);
$custom = str_replace("'", 'ft',$custom);
$custom has the value of a column from CSV. It seems that double quotes are escaped in CSV using double quotes like 15""x5000'
How can I do this in PHP?
var_dump is showing string '15"x5000' Produce Film' (length=22)
CSV in editor is showing "Select the product size and enter the quantity|15""x5000' Produce Film"
Copyright Notice:Content Author:「Akhilesh」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/72785731/replace-escaped-double-quotes-in-csv