SimpleXMLElement how to change tag content (value)
I need to know how do I change content of the tag (not attributes, just content). I dont need inner tags inside this parent tag. I just need to put inside it some text. (Replace "1. Hello World") of the next xml file:

<?xml version="1.0" encoding="UTF-8"?>
<configs>

    <config name="THIS" type="string">1. Hello World)</config>
    <config name="IS" type="string">2. Hello World!</config>
    <config name="SPARTA" type="string">3. Hello World?</config>

</configs>

    // create simple xml object
    $xml = new SimpleXMLElement(file_get_contents('file.xml'));
    
    // new names and values
    $names  = array('THIS', 'SPARTA');
    $values = array('1. Good bye world(', '3. Good bye world?');
    
    // replace here
    foreach($xml as $a => $xmlElement) {
         $indexOfName = array_search($names, (string)$xmlElement['name']);
         if ($indexOfName !== false) {
              // here I need to replace the value (e.g. 1. Hello World)) of config
              // with the attribute @name == $names[$i] with the new value
              // $values[$i] (3. Good bye world?)
         }
    }
SimpleXMLElement how to change tag content (value)
===

I need to know how do I change content of the tag (not attributes, just content). I dont need inner tags inside this parent tag. I just need to put inside it some text. (Replace "1. Hello World") of the next xml file:

<?xml version="1.0" encoding="UTF-8"?>
<configs>

    <config name="THIS" type="string">1. Hello World)</config>
    <config name="IS" type="string">2. Hello World!</config>
    <config name="SPARTA" type="string">3. Hello World?</config>

</configs>

    // create simple xml object
    $xml = new SimpleXMLElement(file_get_contents('file.xml'));
    
    // new names and values
    $names  = array('THIS', 'SPARTA');
    $values = array('1. Good bye world(', '3. Good bye world?');
    
    // replace here
    foreach($xml as $a => $xmlElement) {
         $indexOfName = array_search($names, (string)$xmlElement['name']);
         if ($indexOfName !== false) {
              // here I need to replace the value (e.g. 1. Hello World)) of config
              // with the attribute @name == $names[$i] with the new value
              // $values[$i] (3. Good bye world?)
         }
    }