I have this code:
$accents = ["/[Àà]/", "/[ÈÉèé]/", "/[Ìì]/", "/[Òò]/", "/[Ùù]/"];
$replacement = ["A", "E", "I", "O", "U"];
$to_be_replaced = preg_replace($accents, $replacement, $to_be_replaced);
It is intended to replace all accents (only the ones used in italian) with unaccented letters.
I tried with this:
$to_be_replaced = 'ò'; #first try
$to_be_replaced = 'èàò'; #second try
But I get this output:
1: AO
2: AEAAAO
So it seems to be adding an 'A' everytime before right replace, but I can't really figure out why.
Any suggestion?