Can someone explain to me what is nodeValue in this and write out how nodeValue look like or write out what's in nodeValue? EDIT: Sorry! Yes, this is PHP.
And..
foreach ($elements as $e) {
echo $e->nodeValue;
}
What does the arrow thingy mean (->)? That's an array right? Well if you can explain to me this one part that would be great...
Here's the source:
$html = file_get_contents('http://website.com/');
$dom = new DOMDocument();
@$dom->loadHTML($html);
$xPath = new DOMXPath($dom);
$elements = $xPath->query("//*[@id='announcement']");
foreach ($elements as $e) {
echo $e->nodeValue;
}
Update: I thought I'll write out the question here instead of leaving it in comments. Let's say I had 5 node values found and what if I just wanted to echo the 2nd node value? How would I do that? echo $e->nodeValue2;?