I want to replace some characters with preg_replace in a external file.
I'm trying the code below:
$arch = 'myfile.txt';
$filecontent = file_get_contents($arch);
$patrones = array();
$patrones[0] = '/á/';
$patrones[1] = '/à/';
$patrones[2] = '/ä/';
$patrones[3] = '/â/';
$sustituciones = array();
$sustituciones[0] = 'a';
$sustituciones[1] = 'a';
$sustituciones[2] = 'a';
$sustituciones[3] = 'a';
preg_replace($patrones, $sustituciones, $filecontent);
But it's not working. How could I do that?
Is there any better way to do that?
Thanks a lot.