- var_dump: documentation ( source)
- simplexml_load_string: documentation ( source)
- str_replace: documentation ( source)
- json_encode: documentation ( source)
<?php
$a = '<?xml version="1.0" encoding="UTF-8"?>
<root a="b">
<row b="y">
<item s="t" />
</row>
<row p="c">
<item y="n" />
</row>
</root>';
$simple_xml = @simplexml_load_string($a);
echo "The XML without new lines,tabs\n:";
$b = str_replace( array("\n", "\r", "\t"), "", $a );
echo "The Bug\n:";
$simple_xml = @simplexml_load_string($b);
var_dump($simple_xml);
echo json_encode($simple_xml);