?
Solved

Adding line breaks to code

Posted on 2008-09-30
1
Medium Priority
?
199 Views
Last Modified: 2012-05-05
I'm having trouble producing code that can be easily read by humans in a browsers 'view source'

The code below looks like this in view source;

Line 0<br />Line 1<br />Line 2<br />Line 3<br />Line 4<br />

However I would like view source to look like this (without changing the rendered version of the page);
Line 0<br />
Line 1<br />
Line 2<br />
Line 3<br />
Line 4<br />

Can this be done?
for ($x = 0; $x < 5; $x++) {
  echo 'Line '.$x.'<br />';
}

Open in new window

0
Comment
Question by:Mr_Splash
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 48

Accepted Solution

by:
hernst42 earned 2000 total points
ID: 22604601
You can use this:
for ($x = 0; $x < 5; $x++) {
  echo 'Line '.$x.'<br />'."\n";
}

Open in new window

0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question