How can you access specific values within nested XML elements using SimpleXMLElement in PHP?

When dealing with nested XML elements in PHP using SimpleXMLElement, you can access specific values by using object-oriented syntax to navigate through the elements. You can use the `->` operator to access child elements and attributes within the XML structure. By chaining multiple `->` operators, you can traverse through nested elements to reach the desired value.

$xml = '<root>
    <parent>
        <child1>Value 1</child1>
        <child2>Value 2</child2>
    </parent>
</root>';

$simplexml = new SimpleXMLElement($xml);

// Accessing the value of <child1>
$value = $simplexml->parent->child1;
echo $value; // Output: Value 1