Здравствуйте. Функция str_replace() заменяет только в файлах .xml.
Пример кода:
<?php
$files_parameters = [
[
'name' => 'uploads/loaded-3.csv',
'result' => 'uploads/decode-3.csv',
'change-from' => 'Российский рубль',
'change-to' => 'RUB'
]
];
foreach($files_parameters as $file) {
if (file_exists($file['name'])) {
$source = @fopen($file['name'],'r');
if ($source) {
$target = @fopen($file['result'],'w+');
$f = 0;
while (!@feof($source)) {
$st = @fgets($source, 4096);
$pos = strpos($st, $file['change-from']);
if ($pos or $f) {
$st = str_replace($file['result'], $file['change-to'], $st);
if (substr_count($st, '</param>')) {
$f = 0;
$st = str_replace('param', 'art', $st);
} else $f = 1;
}
fwrite($target, $st);
}
@fclose($source);
@fclose($target);
}
}
}
?>