PHPology is a collective of highly skilled, award winning, web gurus.
Contact Raj on 07985 467 213 or email [email protected]

The perfect php clean url generator

Been searching for a way to basically clean a title so that I could add that to my URL which had accents as I was dealing with French content.

First search on Google got me to this website and the function below worked a treat:

function toAscii($str, $delimiter = '-')
{
$clean = iconv('UTF-8', 'ASCII//TRANSLIT', $str);
$clean = preg_replace("/[^a-zA-Z0-9\/_|+ -]/", '', $clean);
$clean = strtolower(trim($clean, '-'));
$clean = preg_replace("/[\/_|+ -]+/", $delimiter, $clean);
return $clean;
}

Source: http://cubiq.org/the-perfect-php-clean-url-generator