<?php
function stripSpecialCharater($string)
{
return preg_replace(['/\s{2,}|[\t\R]/u', '/[^a-z\d\s&‚~§©ÂÃ⃀-]/ui'], [' ', ''], $string);
//$string = iconv("Windows-1252","UTF-8",urldecode($string));
//$string = preg_replace(array('/\s{2,}/', '/[\t\n]/'), ' ', $string);
//return preg_replace('/[^a-zA-Z0-9ç&-©‚ƒ‘\s]/', '', $string);
}
$tests = ['12 34', 'adsf', 'co©', 'pound £'];
foreach ($tests as $test) {
echo "$test : " , stripSpecialCharater($test), "\n";
}
preferences:
71.1 ms | 402 KiB | 5 Q