3v4l.org

run code in 300+ PHP versions simultaneously
<?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; } }
Output for 7.4.0 - 7.4.30, 8.0.1 - 8.0.22, 8.1.0 - 8.1.9
WordPress 5.9.3 Site Kit by Google 1.73.0

preferences:
33.61 ms | 409 KiB | 5 Q