public function getTitleFromFirstH1($text)
    {
        $matches = [];
        $title = null;

        if (preg_match("#<h1.*?>(.*)</h1>#", $text, $matches)) {
            $title = strip_tags($matches[1]);
        }

        return $title;
    }
public function getTitleFromFirstH1($text)
    {
        $matches = [];
        $title = null;

        if (preg_match("#<h1.*?>(.*)</h1>#", $text, $matches)) {
            $title = strip_tags($matches[1]);
        }

        return $title;
    }
public function getTitleFromFirstH1 ( $ text ) { $ matches = [ ] ; $ title = null ; if ( preg_match ( "#<h1.*?>(.*)</h1>#" , $ text , $ matches ) ) { $ title = strip_tags ( $ matches [ 1 ] ) ; } return $ title ; }
Get the title from the first H1.

@param string $text the text to be parsed.

@return string|null with the title, if its found.
Get the title from the first H1 .