fork(2) download
  1. <?php
  2. $text = "left right\r\nbottom";
  3. function clean($text) {
  4. $text = addcslashes($text, "\x20\t");
  5. $text = preg_replace('/[^\S\n]+/', ' ', $text);
  6. $text = stripslashes($text);
  7. return preg_replace('/[^\S\n]+/', ' ', $text);
  8. }
  9. $text = clean($text);
  10.  
Success #stdin #stdout 0.02s 52480KB
stdin
Standard input is empty
stdout
string(22) ""left right\r\nbottom""
string(21) ""left right \nbottom""