str replace - strip all unnecessary spaces in a php string -


i want strip spaces not between 2 letters:

$string = "              bah    bah    bah bah  "; $string = str_replace("/w /w", "+", $string); // goes here? this: $string = "bah+bah+bah+bah";  

the idea want rid of unnecessary spaces(not @ beginning , end). not link search box on submit exploded + can = or basically

$string = preg_replace('/\s+/', ' ', $string); 

Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -