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.

Converting "Enters" to "Commas"

Discussion in 'PHP' started by Lucky Bastard, Mar 23, 2005.

  1. nullbit

    nullbit Peon

    Messages:
    489
    Likes Received:
    19
    Best Answers:
    0
    Trophy Points:
    0
    #21
    It can be done more than one way, if you want to use the strstr function insead, then this code works (it's your code, but you had a small typo):
    
    if (strstr($entered_field, "\n") || strstr($entered_field, "\r"))
     {
      $entered_field = preg_replace('[\r\n]+', ',', $entered_field);
    }
    
    PHP:

     
    nullbit, Mar 23, 2005 IP