I am trying to make a function that renames file after they have been uploaded but this function doesn’t work and I don’t understand why.
Here is simple example code :
echo $pathinfo["filename"]."<br/>";
$pathinfo["filename"] = preg_replace('/[ÝŶŸỲỸỶỴ]/', "Y", $pathinfo["filename"]);
echo $pathinfo["filename"]."<br/>";
Which outputs :
JPEG xè.w_.a(m)aaỶle_oui_
JPEG xY�.w_.a(m)aaYYYle_oui_
è is transformed into ?? And Ỷ becomes YYY !?
I really don’t understand why I don’t have ‘JPEG xè.w_.a(m)aaYle_oui_’.
Thank you all
You should add
umodifier to your regex if you want to grab Unicode characters.