In the mists of pre-history, the Windows Folk, Mac Folk, and Unix folk couldn't agree on what character(s) should denote the end of a line. On classic Mac OS, it was a carriage return (\r). On Unix, it was a newline (\n). On windows, it was a carriage return followed by a newline (\r\n).
Historically speaking, on old typewriters you had to do two things to get the head onto a new line. A carriage return (the big arm thing) would move the typewriter head back to the left side (or right side; shalom!) of the paper. However, the head would still be on the same line. You've have to engage a second mechanism (line feed or newline) to move the paper itself up a single line.
One of the reasons for the ASCII standard was to encode data that was going to be later printed out (via telegraph, teletype, etc.) so having both characters in the standard made sense. When it came time to decide on a standard for files whose primary purpose was to live in a computer, no one would could agree. The windows standard (\r\n) makes the most literal sense, but the Unix and Classic Mac standards (\n for Unix, \r for Classic Mac) saved a bit per-line, which was important in the early days.
This has caused confusion for decades, and will continue to cause confusion into the future. This is particularly true when using Unix tools in a windows environment. A lot of these tools assume a \n as a line ending. Additionally, it's possible your PHP source file is encoded with unix style line endings, which means a string separated over several lines is actually split up by \n newlines, and your program is behaving correctly.
Most modern text editors will figure out how a text file is encoded, and display the lines "as intended" by the author. Notepad doesn't work like that, and obeys what's literally in the text file.
Irrespective of all that, the following reg ex should normalize your line endings to what's standard on windows
$stringData = preg_replace('/[\n\r]{1,2}$/',"\r\n",$stringData);
Alternately, you could construct your string to end with carriage-return/line-feed
$string = "line 1\r\nline 2";
$string = "line 1\r\n".
"line 2\r\n";