Solved

display result vertically

Posted on 2004-04-15
6
210 Views
Last Modified: 2008-03-10
hello
I have a simple question.
I have array, when i display its result it display horizentally but i want to disply it vertically. So how i can do this.

thx
0
Comment
Question by:manish14
[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
  • 2
6 Comments
 
LVL 17

Accepted Solution

by:
dorward earned 20 total points
ID: 10831237
<ul>
<?php
foreach ($array as $item) {
  print "   <li> $item </li>\n";
}
?>
</ul>
0
 
LVL 6

Expert Comment

by:jkna_gunn
ID: 10831533
or if you dont want listed
just use a <br> tag

foreach ($array as $item) {
  print "$item <br>\n";
}
0
 
LVL 17

Expert Comment

by:dorward
ID: 10831550
Well yes, although it *should* be marked up as a list if it is a list (you can use CSS to change the presentation, e.g. to remove bullets and margins).

The point though is that if you are generating HTML using PHP, then you need to insert HTML markup that causes line breaks if you want line breaks, and if you are generating text then you should insert a new line character: \n
0

Featured Post

Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

Question has a verified solution.

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

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn how to count occurrences of each item in an array.
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…

623 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