Re: while loop: detect next loop?

From: Date: Wed, 27 Mar 2002 21:20:49 +0000
Subject: Re: while loop: detect next loop?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-90429@lists.php.net to get a copy of this message
On Wednesday, March 27, 2002, at 04:11 PM, Matt Friedman wrote:
When you have all your items in an array use implode to add a character in between every item. $str = implode($yourArray, $separator); This will add the separator to the end of each string except the last one.
I like that idea, but I don't think it would work in this case -- for one thing, the array is a pointer to a mysql_fetch_assoc() result, so I am not sure how to implode that (not saying it can't be done), and for another, I would have to explode the array again and would lose the separator. Unless... unless I were to implode with say, a bogus separator AND a 'real' separator, and then explode using only the bogus separator (leaving the 'real' separator hanging onto the end of each element). This seems like it could work, but in a complex array like a mysql_fetch_assoc() result, I'm not sure how to implode. Erik ---- Erik Price Web Developer Temp Media Lab, H.H. Brown pricee@hhbrown.com

« previous php.general (#90429) next »