Link'; //create some arbitrary HTML for the example $dom = new DOMDocument(); //creates special DOM object $dom->loadHTML($content); //generates the DOM for the document $content $xpath = [...]" />

Daniel @ Use Xpath to parse HTML content with PHP

Daniel

@Sharecash

seems like this to me:

$content = ‘Link‘;
//create some arbitrary HTML for the example

$dom = new DOMDocument();
//creates special DOM object

$dom->loadHTML($content);
//generates the DOM for the document $content

$xpath = new DomXPath($dom);
//creates special xpath object that interacts with the DOM object
//for some reason this is never used again in this script. idk why they put it in here.

$tag = $dom->getElementsByTagName(”a”);
//finds all occurrences of the ”a” tag in $content and stores as an array

$counter = $tag->length;
//gets the length of the array

for ($i = 0; $i item($i)->nodeValue;
//result = one individual ”a” tag (at index i in the array $tag)

$content = str_replace($result, ”.$result, $content);
//adding a google fav icon image in front of every ”a” tag in the array $tag

echo $tag->item($i)-> getAttribute(‘href’).”;
//print out all the URL’s of where the links go from each ”a” tag in $content
}