Fair enough, I like to make the best out of every loop (without sacrificing readability of course).
If you are already looping through the array, why not do a little bit more so you don't have to use extra array and call a function (a function that will probably loop through the array again!). On Mon, Apr 26, 2010 at 12:10 PM, Keri Henare <[email protected]> wrote: > I prefer Chris's original. > > Kind regards, > Keri Henare > --------------------------------------------------- > [e] [email protected] > [w] kerihenare.com > [m] (+64) 021 874 552 > > PLEASE NOTE: I check my email 3 times per day and will respond at these > intervals. For anything urgent please ring me. > --------------------------------------------------- > > On 26/04/2010, at 12:06 PM, Sid Bachtiar wrote: > >> On top of my head, I would probably code them like this: >> >> $str = ''; >> foreach ( $temp as $i => $t ) { >> if ($i > 0) $str .= ','; >> $str .= $t['value']; >> } >> >> You can make them one line if you want :-D >> >> On Mon, Apr 26, 2010 at 11:53 AM, chris burgess <[email protected]> wrote: >>> On Mon, Apr 26, 2010 at 11:39 AM, Berend de Boer <[email protected]> wrote: >>>>>>>>> "chris" == chris burgess <[email protected]> writes: >>>> chris> What's the tersest way to turn this >>>> You're clearly not being paid per line of code :-) >>> >>> Fortunately not, I suspect *I* might end up paying if that was the deal ;) >>> >>> Thanks all! I'll live with the foreach for now then. >>> >>> -- >>> NZ PHP Users Group: http://groups.google.com/group/nzphpug >>> To post, send email to [email protected] >>> To unsubscribe, send email to >>> [email protected] >> >> >> >> -- >> Blue Horn Ltd - System Development >> http://bluehorn.co.nz >> >> -- >> NZ PHP Users Group: http://groups.google.com/group/nzphpug >> To post, send email to [email protected] >> To unsubscribe, send email to >> [email protected] > > -- > NZ PHP Users Group: http://groups.google.com/group/nzphpug > To post, send email to [email protected] > To unsubscribe, send email to > [email protected] -- Blue Horn Ltd - System Development http://bluehorn.co.nz -- NZ PHP Users Group: http://groups.google.com/group/nzphpug To post, send email to [email protected] To unsubscribe, send email to [email protected]
