function slugify ( $string ) { $string = transliterator_transliterate ( "Any-Latin; NFD; [:Nonspacing Mark:] Remove; NFC; [:Punctuation:] Remove; Lower();" , $string ); $string = preg_replace ( '/[-\s]+/' , '-' , $string ); $string = trim ( $string , '-' ); return preg_replace ( '/[^-\s\d\w]/' , '' , $string ) ; } echo slugify ( "Я люблю PHP!" );
PHP,CSS,MySQL,CMS,Opencart,Framework