$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.