Hmm, the only thing coming to mind is that there are a variety of newline characters.... "\n" "\r" "CTL-M" etc., etc.
And, worse yet, Windows has a tendency to do this for a line break: "\r\n" --- which could cause issues, I would think.
It might be helpful for you to specify the line break character in your code instead of just typing it; my thinking here is that if you're using notepad, and then saving to a *nix server, it's giving you back exactly what you put in, which may very well be two newline characters (albeit different ones) after each time you hit the "return key"....
Try this, for example:
$file = fopen ("somefile.php", "w");
fwrite ($file, "1\n 2 \n");
fclose ($file);
HTH,