fork(1) download
  1. <?php
  2.  
  3. $str = 'Dummy text
  4.  
  5. some more text
  6.  
  7. and
  8. Dummy text
  9.  
  10.  
  11.  
  12.  
  13.  
  14. some more text';
  15. $result = preg_replace('~(\R{2})\R+~', '$1', $str);
  16. echo $result;
Success #stdin #stdout 0s 52488KB
stdin
Standard input is empty
stdout
Dummy text

some more text

and
Dummy text

some more text