In different text files (or also inside single text file) I have different end-of-lines combinations (see example below).
How to uniform all combinations of CR and LF with one simple CRLF? In a few words I need to replace every CR and LF combinations with one single CRLF using PHP. With str_replace I can replace them but my issue is the right search string to use.
$textfile=str_replace("search string i need","CRLF to replace", $textfile);
Example of a generic text file to fix:
text line 1 CRLFLFCRCRLF
text line 2 LFLFCRLFCRCR
text line 3 CRLF
text line 4 CR
text line 5 LF
I need to replace all the \r \n random combinations with only \r\n like this:
text line 1 CRLF
text line 2 CRLF
text line 3 CRLF
text line 4 CRLF
text line 5 CRLF