Created
July 22, 2015 18:22
-
-
Save NicolasPio/bb26f74237563c81b34f to your computer and use it in GitHub Desktop.
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
public function getSlug($slug) | |
{ | |
$slug = preg_replace('~&([a-z]{1,2})(?:acute|cedil|circ|grave|lig|orn|ring|slash|th|tilde|uml);~i', '$1', htmlentities($slug, ENT_QUOTES, 'UTF-8')); | |
$slug = preg_replace('~[^0-9a-z]+~i', '-', html_entity_decode($slug, ENT_QUOTES, 'UTF-8')); | |
$slug = strtolower( trim($slug, '-') ); | |
return $slug; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
POG