Skip to content

Instantly share code, notes, and snippets.

@joshuamilford
Created July 11, 2011 17:32
Show Gist options
  • Save joshuamilford/1076345 to your computer and use it in GitHub Desktop.
Save joshuamilford/1076345 to your computer and use it in GitHub Desktop.
urlize
function urlize($string){
return preg_replace('/\-+/', '-', preg_replace('/[^a-zA-Z\-_]/', '', preg_replace('/\s+/', '-', strtolower($string))));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment