<?php
function stripSpecialCharater($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";
}
// & is at ASCII decimal place 38
// © is at ASCII decimal place 169
preferences:
58.12 ms | 402 KiB | 5 Q