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.


Leave a Reply