Skip to content

Instantly share code, notes, and snippets.

@skwi
Created April 17, 2012 13:14
Show Gist options
  • Save skwi/2405905 to your computer and use it in GitHub Desktop.
Save skwi/2405905 to your computer and use it in GitHub Desktop.
Make Slug
function slug($str)
{
$str = strtolower(trim($str));
$str = preg_replace('/[^a-z0-9-]/', '-', $str);
$str = preg_replace('/-+/', "-", $str);
return $str;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment