How do I remove multiple blank lines from a string. I have looked at the examples on stackoverflow and have tried to change my code accordingly but I am not getting the rig
Try this one:
$str =preg_replace("/(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+/", "\r\n", $str);
The output file will give same output on simple notepad and also on text editors eg Notepad++.