# Double line breaks in Flash from PHP/XML

**URL:** <https://forum.kirupa.com/t/double-line-breaks-in-flash-from-php-xml/201300>\
**Category:** programming\
**Created:** [September 20, 2006, 8:56am UTC](https://forum.kirupa.com/t/double-line-breaks-in-flash-from-php-xml/201300 "2006-09-20T08:56:17Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mentha](https://avatars.discourse-cdn.com/v4/letter/m/a3d4f5/32.png) [@mentha](https://forum.kirupa.com/u/mentha)\
**Post date:** [September 20, 2006, 8:56am UTC](https://forum.kirupa.com/t/double-line-breaks-in-flash-from-php-xml/201300/1 "2006-09-20T08:56:17Z")

</div>

I use a PHP file to create an XML for loading from SQL to Flash. Unfortunately all my linebreaks are recognized as being double, which, ofsourse, they aren’t. I’ve searched the forum for an answer, but I could not find a solution. Only to the same problem where the XML isn’t created by a PHP like mine is.  
Here’s (part of) my script:

```auto
echo '<?xml version="1.0" encoding="UTF-8"?>' . $nl;
	echo '<ROOT>' . $nl;
	while($r = mysql_fetch_array($result)) {

		echo '<pagina>' . $nl;
		echo '<pageId>' . stripslashes($r['pageId']) . '</pageId>' . $nl;
		echo '<pageTitle>' . stripslashes($r['pageTitle']) . '</pageTitle>' . $nl;
		echo '<pageText><![CDATA[' . stripslashes(str_replace('
','<BR>',$r['pageText'])) . ']]></pageText>' . $nl;
		echo '</pagina>'. $nl;
	}
	echo '</ROOT>' . $nl;

```

The problem arises in the CDATA part, where the actual text is loaded. I’ve tried to add nl2br(), which works, sort of… It removes a break in one part but adds another somewhere else, leaving me with a very odd looking piece of text. I’ve also tries a str\_replace to get rid of any  
or \r in the tekst, but it doesn’t seem to find anything to replace.  
If anyone has any further tips, I’d be very happy to hear them!

[edit]Nevermind, I figured it out. I did need to use a str\_replace, but I had a slight error in it…[/edit]
