I have a few conceptual questions (all related, I think) regarding the following script, at the comments. The script works fine.
The reason for using \r\n would be make the output render nicely when viewed using a Windows source viewer like notepad.exe.
Nothing to do with headers here.
Seeing as the code uses the output buffering functions, I have no idea why they feel the need to try and overflow a 4kb buffer (the default in a standard php.ini though more professionals would opt for no default output buffering).