reduce multiple space with single space using regex

by Guna 2014-02-21 12:53:02

Following snippet will replace multiple white spaces into single, this will be useful when we add user name,titles in database...

$name='Guna sekar v';
$name=preg_replace('/ss+/',' ',$name);
echo $name;


Output:
Guna sekar v

Tagged in:

524
like
0
dislike
0
mail
flag

You must LOGIN to add comments