Assume the following xml document:
<?xml version="1.0"?>
<technicaldata template="123">
    <name>
        <![CDATA[Blub1]]>
    </name>
    <numbers>
        <![CDATA[1
            2
            3
            4
        5]]>
    </numbers>
    <shortinfo>
        <![CDATA[ha ha ha ha ha ha ha ha.]]>
    </shortinfo>
    <detailedinfo>
        <![CDATA[hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi
        hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi hi ]]>
    </detailedinfo>
</technicaldata>
Now I can load the file via simplexml;
$data='test.xml';
$inhalt = simplexml_load_file($data);
After that I want to replace some specific letters in all parts of the xml file - e.g. all appearances of bar should be replaced by foo... thanks to this great community I know it works with a loop like that:
foreach ($inhalt->children() as $child) {
    $child= str_ireplace('bar', 'foo',$child);
}
The problem is that if I now go e.g. to $inhalt->shortinfo it didn't work tough...
But if I use the loop with an echo like this
foreach ($inhalt->children() as $child) {
    $child= str_ireplace('bar', 'foo',$child);
    echo $child;
}
Then the replacement obviously worked but unfortunately the changes get lost when the forech loop is finished; How can I avoid that? Many thanks!! :)
EDIT: Sorry I talk about php... :)