adding a character at the start and end of a-list-of-items

Discussion in 'PHP' started by IamNed, Sep 19, 2011.

  1. #1
    I have long external txt list like this:

    dddd
    ggggb
    btbtgbgb
    gtrbr
    .
    .
    .


    and I want each item to be like this:

    'dddd',
    'ggggb',
    'btbtgbgb',
    'gtrbr',

    how is this done with php?
     
    IamNed, Sep 19, 2011 IP
  2. akumar2

    akumar2 Peon

    Messages:
    30
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    read the file & extract each element by new line . yoo will get a array. then implode the array by ',\n' & add the single quote befre & at then end of result.
     
    akumar2, Sep 20, 2011 IP