3v4l.org

run code in 300+ PHP versions simultaneously
<?php $dataurl = array('http://test.com/embed-990.html', 'http://test2.com/embed-011.html', 'http://test3.com/embed-022.html'); foreach($dataurl as $url) { switch(parse_url($url, PHP_URL_HOST)) { case 'test.com': echo 'test domain'; break; case 'test2.com': echo 'test domain 2'; break; default: echo 'unknown'; break; } echo $url . PHP_EOL; }
Output for 7.0.0 - 7.0.25, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.34, 8.2.0 - 8.2.30, 8.3.0 - 8.3.30, 8.4.1 - 8.4.18, 8.5.0 - 8.5.3
test domainhttp://test.com/embed-990.html test domain 2http://test2.com/embed-011.html unknownhttp://test3.com/embed-022.html

preferences:
111.89 ms | 1698 KiB | 4 Q