The thing I don't like with that assumption is it assumes a numerically keyed
array, I was contemplating something very similar;
$c = 0; foreach($temp as $t) $str .= sprintf("%s%s", ($str++)?",":"",
$t['value']);
:-D
On 26/Apr/2010, at 12:06 , 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]