CODE::URL Alias aus Titel generieren

Moin!

mal wieder etwas Code. Diesmal einen sauberen Alias für z.b. eine URL generieren.

$value = preg_replace(‘~[^\\pL\d]+~u’, ‘-‘, $value);
$value = trim($value, ‘-‘);

$search = array(“Ä”, “Ö”, “Ü”, “ä”, “ö”, “ü”, “ß”, “´”);
$replace = array(“Ae”, “Oe”, “Ue”, “ae”, “oe”, “ue”, “ss”, “”);

$value = str_replace($search, $replace, $value);
$value = iconv(‘utf-8’, ‘ASCII//TRANSLIT’, $value);

$value = strtolower($value);
$value = preg_replace(‘~[^-\w]+~’, ”, $value);

 

Kommentar hinterlassen