Adding a line break in PHP feed output

Hello

I am trying to edit a feed that is created for my blog extension. I want to place a line break after each tag (there is another problem with the feed and bugs are hard to find when it is all on one line) but I cannot get it to work. I have tried /n but this just outputs /n.

It is not echo so I am not sure this is correct to use. Here is the code

            $output  = '<?xml version="1.0" encoding="UTF-8" ?>';
            $output .= '<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">';

Open in new window


I have tried

            $output  = '<?xml version="1.0" encoding="UTF-8" ?> /n';
            $output .= '<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> /n';

Open in new window


this just outputs

<?xml version="1.0" encoding="UTF-8" ?>/n<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> /n

I have also tried

            $output  = '<?xml version="1.0" encoding="UTF-8" ?>';
			$output  = "\n";
            $output .= '<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">';
			$output  = "\n";

Open in new window


This makes these lines disappear and replaced with a single line break.

Can someone please give me some advice?

Many Thanks
Adam JonesAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

gr8gonzoConsultantCommented:
Your second code sample was closest, but it should be:
$output  .= "\n";

The .= operator means append / concatenate

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Adam JonesAuthor Commented:
Thanks. Worked perfectly.
Ray PaseurCommented:
Just a note for going forward, some OS do not use \n for the end-of-line character.  PHP has a context-aware, future-proof, end-of-line character available in a predefined constant: PHP_EOL
http://php.net/manual/en/reserved.constants.php
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.