<?php
require_once('simple_html_dom.php');
function getByClass($element, $class)
{
$content= [];
$html = 'index.html';
$html_string = file_get_contents($html);
$html = str_get_html($html_string);
foreach ($html->find($element) as $element) {
if ($element->class === $class) {
array_push($heading, $element->innertext);
}
}
print_r($content);
}
getByClass("h2", "main");
getByClass("p", "special");