Sorry if this is reposted, but I can\'t wrap my mind around it and I\'ve tried all the available documentation and examples I could find.
I am trying to get the first
The correct answer has already been provided by @nickb but you can also do the same without having to use getNamedItem()
in the second line of the code provided by @nickb, like this:
echo $img->attributes->src->value;
NOTE: I wanted to add the above code as a comment to @nickb's answer, but I need a minimum of 50 reputations to do that. If anyone can write the above code line as a comment to @nickb's answer, please let me know. I will then delete my answer.