How can i turn multiple line breaks into one with preg_replace?

Discussion in 'PHP' started by baris22, Apr 15, 2008.

  1. #1
    Hello,

    I get to many line breaks from an input. How can i turn multiple line breaks into one?

    This code works to turn multiple spaces into one.

    
    
    $description = preg_replace('~[\r\n\s\t]+~', ' ', $description);
    
    
    PHP:
    I want to do the same for line breaks aswell. but i do not know how to do

    Thanks
     
    baris22, Apr 15, 2008 IP