With simplexml_load_file... I've loaded an xml file. Now I want to process this file with javascript, so I created a string of it's content. Unfortunatly this string contains some returns so it can't be read. How can I get rid of these returns.
// this doesn't work because the return is not shown in the code, it just starts at a new line
str_replace('\n','',$string);
I put in the xml as follows:
<?php
$results = simplexml_load_file('file.xml');
$resultsAsString = $results->asXML();
?>
//---
<script>
var xml = '<?= $resultsAsString; ?>';
</script>
And when I view the source it looks like this:
var xml = '<?xmlversion="1.0"?>
<element></element>
';
How do I remove the return after "?>" and after "/element>"