I am trying to strip all special chars and add a dash between all the words.
Example:
Example text: How to make something, something else, and other stuff.
Example string:
$string = "How to make something, something else, and other stuff.";
Example of how it should look: How-to-make-something-something-else-and-other-stuff
I need a function that will strip all special chars but also add the dashes between every word "but also not adding dashes after the last word". Anyone have any ideas of how I should do this? I assume this is fairly simple. probably a preg_replace with regex which would solve the special char problem but adding the dashes is where I get confused and am not sure what to do.