Created
December 19, 2020 19:07
-
-
Save memandip/3a1e42eec549c7eb0c668ed867496ddd to your computer and use it in GitHub Desktop.
Create slug preserving unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function slugify($title){ | |
$slug = preg_replace('/\s+/u', '-', trim($title)); | |
$slug = preg_replace("/[~`{}.'\"\!\@\#\$\%\^\&\*\(\)\_\=\+\/\?\>\<\,\[\]\:\;\|\\\]/", "", $slug); | |
return $slug; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment