Jump to content

stuckwithcode

Members
  • Posts

    76
  • Joined

  • Last visited

    Never

Posts posted by stuckwithcode

  1. I am trying to make sure that all line breaks in a piece of text are converted to \r\n.  When I use the code below for:

     

    a

    b

    c

     

    $text = str_replace(array("\r\n","\r","\n"), "\r\n", $text);

     

     

    After using mysql_real_escape_string the output shows:

     

    a\r\r\n\r\nb\r\r\n\r\nc

     

    Where am I going wrong? I expected it to remain at a\r\nb\r\nc

     

    If I use $text = str_replace(array("\r\n","\r","\n"), "\r", $text); , it works.

     

     

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.