This one has some extra stuff for German characters in it. Probably not needed because it’s covered by iconv, but whatever:
function slugify($str) { $returnMe = strtotime(trim(@iconv('UTF-8', 'ASCII//TRANSLIT', $str))); foreach ([ " " => "_", "/" => "-", "" => "", "." => "-", "ü" => "ue", "ö" => "oe", "ä" => "ae", "ß" => "ss", "&" => "+", '"' => "_" ] as $search => $replace) { $returnMe = str_replace($search, $replace, $returnMe); } return $returnMe; }