3v4l.org

run code in 300+ PHP versions simultaneously
<?php $meta = '<meta content="21;URL=\'http://example.com/\'" http-equiv="refresh" /> <meta content="21;URL=\'http://example.com/?PageSpeed=noscript\'" http-equiv="refresh" />'; $dom = new DOMDocument; $dom->loadHTML($meta); $noPageScripts = []; foreach ($dom->getElementsByTagName('meta') as $tag) { $content = $tag->getAttribute('content'); // Match the URL preg_match('/URL=["\']?([^"\'>]+)["\']?/i',$content,$matches); if($tag->getAttribute('http-equiv') && isset($matches[1]) && stripos($matches[1],'?PageSpeed=noscript') === false) { $noPageScripts[] = [ 'originalTag' => $dom->saveHTML($tag), 'url' => $matches[1] ]; } } var_dump($noPageScripts);

preferences:
30.37 ms | 405 KiB | 5 Q