Print just the values with SimpleXMLElement

I’m pulling data in from an xml file and it’s printing more than the values. I just want the values.
I’m using this code

<?php
$url = 'site.com';

$result = file_get_contents($url, false);
if ($result === false) {
    /* Handle error */
}
 $output = $result;
 $xml = simplexml_load_string($output);?>

<pre><?php echo print_r($xml);?></pre>
Gives me this:

     SimpleXMLElement Object
(
    [@attributes] => Array
        (
            [returnVersion] => 2022v5.0
        )
    [ReturnHeader]
    [ReturnData] => SimpleXMLElement Object
            [FromForm] => SimpleXMLElement Object

                    [DataGrp]
                            [DataGrpPerson] => Array
                                (
                                    [0] => SimpleXMLElement Object
                                        (
                                            [PersonNm] => Joan Jett
                                            [USAddress] => SimpleXMLElement Object
                                                (
                                                    [AddressLine1Txt] => 0 EAST Main STREET
                                                    [CityNm] => CITY NAME
                                                    [StateAbbreviationCd] => STATE NAME
                                                    [ZIPCd] => ZIP NUMBER
                                                )

                                            [TitleTxt] => POSTION TITLE

                                        )
                                    [1] => SimpleXMLElement Object
                                        (
                                            PersonNm] => Tom Petty
                                            [USAddress] => SimpleXMLElement Object
                                                (
                                                    [AddressLine1Txt] => 1 EAST Main STREET
                                                    [CityNm] => CITY NAME
                                                    [StateAbbreviationCd] => STATE NAME
                                                    [ZIPCd] => ZIP NUMBER
                                                )

                                            [TitleTxt] => POSTION TITLE
                                        )

                                    [2] => SimpleXMLElement Object
                                        (
                                            PersonNm] => Brandi Carlile
                                            [USAddress] => SimpleXMLElement Object
                                                (
                                                    [AddressLine1Txt] => 2 EAST Main STREET
                                                    [CityNm] => CITY NAME
                                                    [StateAbbreviationCd] => STATE NAME
                                                    [ZIPCd] => ZIP NUMBER
                                        )

                                

)
This is the Html I am using to display the data

<?php foreach ($xml->ReturnData->FromForm->DataGrp]->DataGrpPerson[0]->PersonNm as $item) {
    echo print_r($item);}?>, <?php foreach ($xml->ReturnData->FromForm->DataGrp]->DataGrpPerson[0]->TitleTxt as $item) {
    echo print_r($item);}?>

Here’s the output (just the names and title)

SimpleXMLElement Object ( [0] => Joan Jett ) 1, SimpleXMLElement Object ( [0] => POSTION TITLE ) 1
SimpleXMLElement Object ( [0] => S Tom Petty ) 1, SimpleXMLElement Object ( [0] => POSTION TITLE ) 1
SimpleXMLElement Object ( [0] => Brandi Carlile ) 1, SimpleXMLElement Object ( [0] => POSTION TITLE ) 

How can I get just the values?

I’ve combed through stackoverflow for days. I cannot find anyone describing this problem