Tutorial Create URL Slug from Post Title
Regular expression function that replaces spaces between words with hyphens. function create_slug($string){ $slug=preg_replace('/[^A-...
https://iskablogs.blogspot.com/2014/03/tutorial-create-url-slug-from-post-title.html
Regular expression function that replaces spaces between words with hyphens.
function create_slug($string){
$slug=preg_replace('/[^A-Za-z0-9-]+/', '-', $string);
return $slug;
}
echo create_slug('does this thing work or not');
//returns 'does-this-thing-work-or-not'
?>
function create_slug($string){
$slug=preg_replace('/[^A-Za-z0-9-]+/', '-', $string);
return $slug;
}
echo create_slug('does this thing work or not');
//returns 'does-this-thing-work-or-not'
?>