I think this is the simplest way to slugify urls. You have any contra-indication?
function url_clean($str)
{
$str = iconv('utf-8', 'us-ascii//TRANSLIT', $str);
$clean_str = preg_replace(array(
'/\'|\"/',
'/ /'
) , array(
'',
'-'
) , $str);
return $clean_str;
}
UPDATE
the code above working great on local, but on the server return string with ?
instead of transliterated characters: árvíztűrő
-> ?rv?zt?r?
phpinfo()
on localhost
iconv support enabled
iconv implementation "libiconv"
iconv library version 1.14
phpinfo()
on server
iconv support enabled
iconv implementation glibc
iconv library version 2.12