3v4l.org

run code in 300+ PHP versions simultaneously
<?php function test($check) { $rx = '_^(https?)://([^:/?]+)(?::(\d+))?(?:(/[^?]+))?(?:\?(.*))?$_i'; echo "Test $check\n"; if (!preg_match($rx, $check, $m)) { echo "\tFAIL!\n"; } else { var_export($m); echo "\n"; } } test(''); test('http://www.example.com'); test('http://www.example.com:8080'); test('http://www.example.com/some/path'); test('http://www.example.com:8080/some/path'); test('http://www.example.com?queryString'); test('http://www.example.com/some/path?queryString'); test('http://www.example.com:8080/some/path?queryString');

preferences:
36.4 ms | 402 KiB | 5 Q