Today I am here to explain you that how to replace all white spaces with a single space in php with the help of pregamatch method. You can use following method.
$input = 'Hello firends. how are you.';
$output = preg_replace('/\s+/', ' ',$input);
echo $output;
0 Comment(s)