Get rid of line breaks

From: Date: Sun, 18 Jun 2006 16:07:24 +0000
Subject: Get rid of line breaks
Groups: php.general 
Request: Send a blank email to php-general+get-238240@lists.php.net to get a copy of this message
Best group member, I have a variable $content that is taken from a database. It contains line breaks and the $content will be posted with line breaks. I need to use this to insert this into a JavaScript function: $output = 'writeRichText(\'rte1\', \''.$content.'\', 400, 200, true, false);'; What is actually outputted is: writeRichText('rte1', '<p>a</p> <h2>b</h2>', 400, 200, true, false); Because it is on different lines in the HTML the javascript function will not be called correct. So can I remove all line breaks in a variable with a function call? Dream: $content = stripLineBreaks($content); I read the manual, but without luck. Thanks in advance.

« previous php.general (#238240) next »