remove multiple line in php from string

$contents = preg_replace("/[\r\n]+/", "\n", $contents); The + quantifier tells the pattern matcher to repeat the previous item once or more. So it'll grab all of the extras in a row and replace them with one.

Discover more from Soa Technology | Aditya Website Development Designing Company

Subscribe to get the latest posts sent to your email.



Leave a Reply

Discover more from Soa Technology | Aditya Website Development Designing Company

Subscribe now to keep reading and get access to the full archive.

Continue reading