I know this is very simple question, but I’m apparently terrible at coding and need a bit of advice as I just started using XPath.
I just used the Xpath function $xpath->query("//a[contains(@id, 'title_')]/@href"); to grab a bunch of links. I’m wondering how I manipulate this data, such as store it into an array? I know how to call each part individually (ie: $hrefs->item(0)->nodeValue;) but beyond that I have no clue.
Thanks a bunch!
The query method returns a DOMNodeList. While this itself isn’t an array, you can still iterate over it like an array. For example: