Are there best practices for using XPath in PHP to retrieve multiple tag elements?

When using XPath in PHP to retrieve multiple tag elements, it is best practice to use the `query()` method along with the `DOMXPath` class. This allows you to specify the XPath expression to target the desired elements and retrieve them as a node list. You can then iterate over the node list to access the individual elements.

// Load the XML file
$xml = new DOMDocument();
$xml->load('example.xml');

// Create a new XPath object
$xpath = new DOMXPath($xml);

// Define the XPath expression to retrieve multiple tag elements
$elements = $xpath->query('//tag');

// Iterate over the node list to access the individual elements
foreach ($elements as $element) {
    echo $element->nodeValue . "\n";
}