I want to replace multiple spaces for a single space in a string. please advise on how to do it. Example code:
<?php
$input="bikash ranjan nayak";
echo $output =preg_replace('/(( )+|(\\n)+)/', '$2$3',$input);
?>
the output is coming :
"bikash ranjan nayak"