Skip to content

Instantly share code, notes, and snippets.

View roshangautam's full-sized avatar
🎯
Focusing

Roshan Gautam roshangautam

🎯
Focusing
View GitHub Profile
static public function slugify($text)
{
// replace non letter or digits by -
$text = preg_replace('~[^\\pL\d]+~u', '-', $text);
// trim
$text = trim($text, '-');
// transliterate
$text = iconv('utf-8', 'us-ascii//TRANSLIT', $text);