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