Maybe you need value of content attribute?
$metas = $dom->getElementsByTagName('meta');
for($i=0; $i <$metas-> length; $i++){
$itemprop = $metas->item($i)->getAttribute("itemprop");
$content = $metas->item($i)->getAttribute("content");
if ($itemprop == "datePublished" && $content !== ''){
$res['published'] = $content;
}
}
var_dump($res);
Be careful, this code valid for the html example that shows in question. Just you can see direction of your code