Using DOM is usually the best idea for stuff like that.
$html = <<<HTML
<html>
<body>
<span itemprop="average" content="XX"></span>
</body>
</html>
HTML;
libxml_use_internal_errors(TRUE);
$dom = new DOMDocument();
$dom->loadHtml($html);
$xpath = new DOMXpath($dom);
$content = $xpath->evaluate('string(//span[@itemprop = "average"]/@content)');
var_dump($content);
libxml_use_internal_errors() disables the error output for bad html. You can use libxml_get_errors() to read them and libxml_clear_errors() to clear the current error buffer.
Next a DOMDocument is created and html is loaded. DOMDocument::loadHtmlFile() would allow to load it from a file or url.
After loading the document you can create an DOMXpath object for the loaded document, it allows you to query elements from it.
DOMXpath::evaluate() allows you to query node lists and scalars from the document. The string typecast inside the xpath expressions casts the attribute node to a string and returns the value. Without the typecast the result would be an DOMNodelist containing any count of DOMAttribute nodes. With it, the result is the attribute value or an empty string.