| 
	
 | 
 Posted by Michael Austin on 01/26/06 20:00 
John K wrote: 
> I'm new to PHP and come from and ASP background... 
>  
> 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>") 
 
an example from the PHP manuals: 
 
	$text="this is my text string\r\n";	 
	$text=str_replace("\r\n","<br>",$text); 
or 
	$text=str_replace("\r\n","<br>",$_POST['myvariable']); 
where: 
"\r" = CR 
"\n" = LF 
>  
> 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.   
 
str_replace([old_string],[new_string],[text string]) 
 
	where old_string and new_string can be an array of text. 
 
>  
> Thanks for the help! 
>  
 
You're welcome. 
 
Michael.
 
[Back to original message] 
 |