Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- Replace in PHP
January 26, 2006, 4:05 pm
rate this thread
I want to replace line feeds in user submited textareas with <br> or
<p> or <div>. In ASP I do this to replace carriage return/line feeds
with <p> in a record of a recordset...
Replace(rsWhatever("fld_whatever_field"), vbCrLf, "<p>")
I don't know how to accomplish this in PHP. I know I have to use
str_replace() but I'm confused by the syntax.
Thanks for the help!
Re: Replace in PHP
an example from the PHP manuals:
$text="this is my text string\r\n";
"\r" = CR
"\n" = LF
where old_string and new_string can be an array of text.