Re: foreach question
| From: | Lori Lay | Date: | Mon, 09 Apr 2007 04:20:23 +0000 |
| Subject: | Re: foreach question | ||
| References: | 1 2 3 4 5 6 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-252286@lists.php.net to get a copy of this message | ||
chris@aquanuke.com wrote:
"both examples do the same thing.." no, ex1 only has 1 <br /> so outputs like.. item1item2item3item4item5<br /> Where as I want this.. item1<br /> item2<br /> item3<br /> item4<br /> item5<br /> ie a line break after every item. Silly question, perhaps, but are you sure $_POST is an array (with 5 elements)? What you have written should produce a break after each item if POST is a 5 element array. However if POST is a single element with the five items concatenated together, then they would be printed the way you have it listed above...It might be better to post the full script to the list. Lori
----- Original Message ----- From: "Sebe" <sebastian@dslr.net> To: <chris@aquanuke.com> Cc: <php-general@lists.php.net> Sent: Monday, April 09, 2007 1:22 AM Subject: Re: [PHP] foreach questionchris@aquanuke.com wrote:I have ..both examples do the same thing.. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.phpforeach( $_POST as $key ) { echo "$key<br />";} and that gives me item1 item2 item3 item4 item5<br /> how do I write it to give me item1<br /> item2<br /> item3<br /> item4<br /> item5<br /> Thanks