PHP Quick Convert String to Slug
Another quick and simple one:
function to_slug($string){
return strtolower(trim(preg_replace('/[^A-Za-z0-9-]+/', '-', $string)));
}
// Input: This is My Title
// Returns: this-is-my-title
Devtrepreneur from Scotland
Another quick and simple one:
function to_slug($string){
return strtolower(trim(preg_replace('/[^A-Za-z0-9-]+/', '-', $string)));
}
// Input: This is My Title
// Returns: this-is-my-title