I’m trying to replace certain characters with some other strings
I got it to work on my main page with this exact code but on another page it wont work.
In the database i Got this ±1¢2£¥3§4£ as description2
In my php i use
$description2 = mysql_result($product, 0, 'productDescription2');
if ($description2 !=""){
$searchArray = array('±', '¢', '£', '¥', '§');
$replaceArray = array('x', 'x', 'x', 'x', 'x');
$teknisk = str_replace($searchArray, $replaceArray, $description2);}
And as the output i use echo ''. $teknisk .'';
But the result is this �1�2��3�4� (The same as the original description2)
instead of x1x2xx3x4x
Please help!
I think since you have some weird characters they might go beyond ascii range and you might need to use multibyte string functions, though it does not have str_replace analogue, you might need to use multibyte regexes.