- Output for 7.4.0 - 7.4.33, 8.0.1 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
- WordPress 5.9.3 Site Kit by Google 1.73.0
<?php
$html = '<meta name="generator" content="WordPress 5.9.3">
<meta name="generator" content="Site Kit by Google 1.73.0">
';
$doc = new DOMDocument();
$doc->loadHTML($html);
$metas = $doc->getElementsByTagName('meta');
foreach($metas as $meta){
if($meta->getAttribute('name') == 'generator'){
echo $meta->getAttribute('content') . PHP_EOL;
}
}