I have a form which currently accepts a tabbled white space " " for example. I only want to allow one space between words.
Currently it looks like this:
preg_replace ("#[^0-9a-z]#i", " ",$string);
Remember I need to allow only one space at a time, How do I fix this?
Replace multiple whitespaces with a single space
$string = preg_replace('/\s\s+/',' ', $string);