[ create a new paste ] login | about

Link: http://codepad.org/no6zs3oo    [ raw code | output | fork ]

PHP, pasted on May 30:
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 );


Output:
1
string(45) "This is a dummy text . I need to format this."


Create a new paste based on this one


Comments: