Skip to content

Instantly share code, notes, and snippets.

@memandip
Created December 19, 2020 19:07
Show Gist options
  • Save memandip/3a1e42eec549c7eb0c668ed867496ddd to your computer and use it in GitHub Desktop.
Save memandip/3a1e42eec549c7eb0c668ed867496ddd to your computer and use it in GitHub Desktop.
Create slug preserving 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