implode or what?

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

I'm not quite sure which function to use when I want to add a comma to
the end of every line and a semi colon to the last one. Because it
generates everything on the fly I can't count the rows from a db.
Here's what I want to do:

red,      <--Comma
green,   <--Comma
blue,     <--Comma
orange; <--Last one so semi colon

Any help is greatly appreciated

Re: implode or what?

Igoogler contained the following:

Quoted text here. Click to load it

assuming the above are in an array called $colours

echo implode(",",$colours).";";

But this is so basic, couldn't you have got the answer by looking at the
manual and trying a few examples?
Geoff Berrow  0110001001101100010000000110
100110001101101111001011100111010101101011 -

Site Timeline