1 2 3 4 5 6 7 8 9 10 11 12 13
<?php $str = "This is a dummy text . I need to format this."; $str = preg_replace( "/\s+/", " ", $str ); var_dump( $str );
1
string(45) "This is a dummy text . I need to format this."