Re: Problems with arrays

From: Date: Thu, 17 Jun 2004 13:12:28 +0000
Subject: Re: Problems with arrays
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-188478@lists.php.net to get a copy of this message
What are you outputting? html, text, email body...?? ----- Original Message ----- From: "Phpu" <phpu@go.ro> To: "Oliver Hankeln" <oha@walter-interactive.de> Cc: <php-general@lists.php.net> Sent: Thursday, June 17, 2004 9:06 AM Subject: Re: [PHP] Problems with arrays > I've tried this but it is not working ... > > Thanks anyway > ----- Original Message ----- > From: "Oliver Hankeln" <oha@walter-interactive.de> > To: <php-general@lists.php.net> > Sent: Thursday, June 17, 2004 4:04 PM > Subject: Re: [PHP] Problems with arrays > > > > Phpu wrote: > > > > > Hi, > > > > > > I have this array: > > > > > > $array = array(element1, element2, element3, element4) > > > > > > I want to list all elements of this array, so i used: > > > > > > foreach ($array as $index => $element) { > > > $InputString = "$element"; > > > echo "$InputString"; > > > } > > > > > > but this code lists the elements like this: element1 element2 element3 > element4 > > > > > > How can i list my elements like this: > > > element1 > > > element2 > > > element3 > > > element4 > > > > That's not a problem with arrays. This is one with outputting. You need > > to add a newline to your echo Statement. Either echo "$InputString\n"; > > or echo "$InputString<br>"; depending on wether you use html or plain > text. > > > > Oliver > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > > >

« previous php.general (#188478) next »