implode or what?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Igoogler

    implode or what?

    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
  • Geoff Berrow

    #2
    Re: implode or what?

    Message-ID:
    <c7ac34e9-67cf-4901-987d-6af03f29f862@b3 8g2000prf.googl egroups.comfrom
    Igoogler contained the following:
    >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
    assuming the above are in an array called $colours

    echo implode(",",$co lours).";";

    But this is so basic, couldn't you have got the answer by looking at the
    manual and trying a few examples?
    --
    Geoff Berrow 011000100110110 0010000000110
    001101101011011 001000110111101 100111001011
    100110001101101 111001011100111 010101101011
    http://slipperyhill.co.uk - http://4theweb.co.uk

    Comment

    Working...