3v4l.org

run code in 500+ PHP versions simultaneously
<?php $urls = [ 'https://example.com/api/', 'https://www.example.com/test-subpath', 'https://www.example.com', 'example.com/test/page', 'www.example.com', 'www.subdomain.example.com', 'https://www.subdomain.example.com', 'subdomain.example.com', 'http://subdomain.example.com', 'https://subdomain.example.com', ]; foreach ($urls as $url) { echo filter_var($url, FILTER_VALIDATE_URL) ? 'OKAY' : 'FAIL', ': ', $url, PHP_EOL; }
Output for 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
OKAY: https://example.com/api/ OKAY: https://www.example.com/test-subpath OKAY: https://www.example.com FAIL: example.com/test/page FAIL: www.example.com FAIL: www.subdomain.example.com OKAY: https://www.subdomain.example.com FAIL: subdomain.example.com OKAY: http://subdomain.example.com OKAY: https://subdomain.example.com

preferences:
57.43 ms | 1015 KiB | 4 Q