Whenever I have to generate code dynamically using echo, it's difficult to debug using my browser's "view source" option, because there are no newlines in it--it's all just one long, hard-to-read string. I've poked around for a solution, and so far I've found that most people seem to think that you can just echo '\n\r' and then you'll see newlines when you view the source. I've never seen that work on any browser. You just literally see '\n\r'. After a lot of fooling around, I've found that echoing chr(10) . chr(13) seems to work. And sure, if you're generating HTML you could use '<br/>', but then you've changed your HTML, and you can't use '<br/>' if you're generating Javascript or CSS on the fly.