I want to receive an array that contains all the h1 tag values from a text
Example, if this where the given input string:
hello
function getTextBetweenTags($string, $tagname){ $d = new DOMDocument(); $d->loadHTML($string); $return = array(); foreach($d->getElementsByTagName($tagname) as $item){ $return[] = $item->textContent; } return $return; }