Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function slugify($string){
- $string = strtolower(trim($string));
- $string = str_replace(array('å', 'ä', 'ö'), array('a', 'a', 'o'), $string);
- $string = preg_replace('/[^a-z0-9-]/', '-', $string);
- $string = preg_replace('/-+/', "-", $string);
- return $string;
- }
- UTF-8
- function slugify($string){
- $string = mb_strtolower(trim($string),'UTF-8');
- $string = str_replace(array('å', 'ä', 'ö'), array('a', 'a', 'o'), $string);
- $string = preg_replace('/[^a-z0-9-]/', '-', $string);
- $string = preg_replace('/-+/', "-", $string);
- return $string;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement