1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

string problem

Discussion in 'PHP' started by dizyn, May 25, 2008.

  1. #1
    Hello all

    I want to read sting and do some processing.

    for example here is my sample string.
    "this is my test string
    new line"

    I want to read this string and then i want to add a "-" at the end of every line, is there way to do this?

    result should be like this:
    "this is my test string-new line"


    thank you
    dizyn
     
    dizyn, May 25, 2008 IP
  2. krakjoe

    krakjoe Well-Known Member

    Messages:
    1,795
    Likes Received:
    141
    Best Answers:
    0
    Trophy Points:
    135
    #2
    $string = str_replace( "\n", "-\n", $string );
    PHP:
     
    krakjoe, May 25, 2008 IP