Supposing we have a CSV created with the following items splitted by ;
A B C D E F
G H I J K L
M N O P Q R
I'm trying to figure out how can I use the following code
$f = fopen($file, "r");
while ($row = fgetcsv($f,'',';')) {
if ($row[1] == 'H') {
echo ('FOUND ! ');
}
}
To open the file and after that for the item H found in the CSV file, I would like to replace the K item with K+replace. How is this done?
I want to use this to conditionally insert values in a million entries CSV, I mean if one element is found to update this item with other value.
I am choosing CSV due to the fact that MySQL taking more than 0.5 seconds to search-find-update/replace per item. (everything done in a loop).