What is the correct method to access the value of an attribute in an xpath query in PHP?

When accessing the value of an attribute in an XPath query in PHP, you can use the `@` symbol followed by the attribute name within square brackets. This allows you to target specific attributes within an XML or HTML document.

// Example XPath query to access the value of an attribute
$doc = new DOMDocument();
$doc->loadHTML($html);

$xpath = new DOMXPath($doc);
$attributeValue = $xpath->query('//div[@class="example-class"]/@data-attribute')->item(0)->nodeValue;

echo $attributeValue;