ldsmike88 Posted November 11, 2006 Share Posted November 11, 2006 I am passing a variable from php to a javascript function. It is a couple of paragraphs worth of text and javascript wont take it if there are any line breaks in it. I figured I could use a string replace to take out all the carriage returns and that would solve the problem but when I do that it puts my replacement where there is a line break but it doesn't take out the line break. Does anyone know why and how to fix it? Thanks!Michael Link to comment https://forums.phpfreaks.com/topic/26901-string-replace-carriage-return/ Share on other sites More sharing options...
Nicklas Posted November 11, 2006 Share Posted November 11, 2006 [code=php:0]$string = str_replace("\r\n", '', $string);[/code] Link to comment https://forums.phpfreaks.com/topic/26901-string-replace-carriage-return/#findComment-123031 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.