3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace NotGlobal; const PHP_URL_SCHEME = 0x001; const PHP_URL_USER = 0x002; const PHP_URL_PASS = 0x004; const PHP_URL_HOST = 0x008; const PHP_URL_PORT = 0x010; const PHP_URL_PATH = 0x020; const PHP_URL_QUERY = 0x040; const PHP_URL_FRAGMENT = 0x080; const PHP_URL_ALL = 0x0FF; const PHP_URL_REQUIRE_SCHEME = 0x100; const PHP_URL_DISALLOW_EMPTY_AUTHORITY = 0x200; function parse_url($url, $flags = PHP_URL_ALL) { static $map = [ PHP_URL_SCHEME => 'scheme', PHP_URL_USER => 'user', PHP_URL_PASS => 'pass', PHP_URL_HOST => 'host', PHP_URL_PORT => 'port', PHP_URL_PATH => 'path', PHP_URL_QUERY => 'query', PHP_URL_FRAGMENT => 'fragment', ]; static $pattern = <<<EXPR ! ^ (?: (?P<scheme> [a-z][a-z0-9+.\-]* ) [:] )? (?: (?<hasauthority> [/][/] ) (?: (?P<user> [^:@/\s]+ ) (?: [:] (?P<pass> [^:@/\s]+ ) )? [@] )? (?P<host> [^:/?#\s]* ) (?: [:] (?P<port> [0-9]+ ) )? (?= [/?#]|$ ) )? (?P<path> [^?#\s]+ )? (?: [?] (?P<query> [^#\s]+ ) )? (?: [#] (?P<fragment> \S+ ) )? $ !xi EXPR; if (!preg_match($pattern, trim($url), $matches)) { return 1; } if ($flags & PHP_URL_REQUIRE_SCHEME) { if (!isset($matches['scheme']) || $matches['scheme'] === '') { return 2; } } if ($flags & PHP_URL_DISALLOW_EMPTY_AUTHORITY) { if (isset($matches['hasauthority']) && $matches['hasauthority'] && (!isset($matches['host']) || $matches['host'] === '')) { return 3; } } // Default to all components, allowing the above flags // to be specified without specifying the components $flags = $flags & PHP_URL_ALL ?: PHP_URL_ALL; $result = []; foreach ($map as $flag => $component) { if (($flags & $flag) && isset($matches[$component]) && $matches[$component] !== '') { $result[$component] = $flag === PHP_URL_PORT ? (int) $matches[$component] : $matches[$component]; } } return count($result) === 1 ? end($result) : $result; } $url = 'http:/test'; var_dump(parse_url($url, PHP_URL_PATH));

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
8.3.60.0090.00618.41
8.3.50.0060.01021.21
8.3.40.0120.00919.09
8.3.30.0070.00720.34
8.3.20.0080.00019.01
8.3.10.0050.00321.04
8.3.00.0000.00722.45
8.2.180.0090.00617.00
8.2.170.0130.00322.96
8.2.160.0080.00620.38
8.2.150.0040.00424.18
8.2.140.0100.00724.66
8.2.130.0040.00426.16
8.2.120.0080.00017.88
8.2.110.0000.01019.29
8.2.100.0070.00419.70
8.2.90.0050.00317.73
8.2.80.0000.00818.98
8.2.70.0030.00517.75
8.2.60.0040.00417.73
8.2.50.0030.00518.04
8.2.40.0060.00320.00
8.2.30.0030.00619.41
8.2.20.0080.00017.91
8.2.10.0000.00817.80
8.2.00.0040.00417.99
8.1.280.0120.00325.92
8.1.270.0080.00022.14
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0030.00619.55
8.1.230.0060.00620.93
8.1.220.0000.00818.94
8.1.210.0000.00818.77
8.1.200.0050.00317.79
8.1.190.0030.00617.60
8.1.180.0000.00818.10
8.1.170.0050.00317.72
8.1.160.0040.00418.86
8.1.150.0050.00218.76
8.1.140.0020.00517.65
8.1.130.0000.00717.90
8.1.120.0060.00317.71
8.1.110.0000.00717.64
8.1.100.0040.00417.66
8.1.90.0000.00817.54
8.1.80.0070.00017.68
8.1.70.0040.00417.64
8.1.60.0030.00517.81
8.1.50.0000.00817.66
8.1.40.0000.00817.70
8.1.30.0080.00017.74
8.1.20.0000.00817.89
8.1.10.0040.00417.75
8.1.00.0080.00017.59
8.0.300.0000.00718.77
8.0.290.0060.00317.00
8.0.280.0040.00418.51
8.0.270.0040.00417.26
8.0.260.0000.00716.99
8.0.250.0070.00017.23
8.0.240.0060.00317.24
8.0.230.0040.00317.17
8.0.220.0070.00017.20
8.0.210.0040.00417.13
8.0.200.0000.00717.21
8.0.190.0040.00417.10
8.0.180.0070.00017.18
8.0.170.0040.00417.02
8.0.160.0040.00417.20
8.0.150.0070.00017.14
8.0.140.0070.00017.12
8.0.130.0000.00613.61
8.0.120.0060.00316.99
8.0.110.0000.00817.01
8.0.100.0070.00017.12
8.0.90.0030.00516.95
8.0.80.0090.00617.12
8.0.70.0000.00817.10
8.0.60.0040.00417.21
8.0.50.0000.00817.14
8.0.30.0100.01017.21
8.0.20.0090.01017.40
8.0.10.0000.00717.23
8.0.00.0200.01217.17
7.4.330.0050.00016.82
7.4.320.0030.00316.89
7.4.300.0060.00016.76
7.4.290.0000.00716.78
7.4.280.0000.00716.77
7.4.270.0000.00716.82
7.4.260.0000.00513.65
7.4.250.0050.00316.73
7.4.240.0040.00416.80
7.4.230.0000.00716.60
7.4.220.0000.02016.72
7.4.210.0080.00816.74
7.4.200.0000.00716.52
7.4.190.0040.00417.02
7.4.160.0150.00316.86
7.4.150.0090.00917.40
7.4.140.0120.00617.86
7.4.130.0070.01016.79
7.4.120.0100.00716.77
7.4.110.0030.01416.66
7.4.100.0090.00916.63
7.4.90.0110.00716.75
7.4.80.0100.01019.39
7.4.70.0090.01316.51
7.4.60.0160.00316.75
7.4.50.0060.00316.58
7.4.40.0070.01122.77
7.4.30.0150.00516.73
7.4.00.0030.01215.17
7.3.330.0050.00013.63
7.3.320.0000.00613.61
7.3.310.0070.00016.66
7.3.300.0000.00716.59
7.3.290.0080.01216.61
7.3.280.0100.01016.63
7.3.270.0140.00417.40
7.3.260.0100.01018.24
7.3.250.0080.01116.66
7.3.240.0040.01416.61
7.3.230.0060.01116.71
7.3.210.0060.01116.83
7.3.200.0140.00519.39
7.3.190.0150.00616.63
7.3.180.0030.01616.80
7.3.170.0030.01216.91
7.3.160.0060.01316.89
7.3.120.0070.01115.07
7.3.10.0100.01016.36
7.3.00.0160.01016.52
7.2.330.0180.00616.93
7.2.320.0140.00717.11
7.2.310.0100.00716.94
7.2.300.0030.01416.88
7.2.290.0070.01416.88
7.2.130.0120.00616.98
7.2.120.0110.01117.04
7.2.110.0040.01117.04
7.2.100.0060.00617.00
7.2.90.0120.00617.02
7.2.80.0180.00017.04
7.2.70.0140.00717.04
7.2.60.0030.01417.06
7.2.50.0080.01217.09
7.2.40.0120.01217.01
7.2.30.0070.00716.99
7.2.20.0000.01116.84
7.2.10.0090.00917.05
7.2.00.0090.00818.34
7.1.250.0110.01115.85
7.1.100.0000.01318.57
7.1.70.0000.00917.44
7.1.60.0100.01419.17
7.1.50.0240.01435.01
7.1.00.0000.03722.47
7.0.200.0070.00017.02
7.0.140.0070.07021.95
7.0.100.0270.07019.91
7.0.90.0170.05720.01
7.0.80.0270.08319.92
7.0.70.0300.05719.93
7.0.60.0270.07720.10
7.0.50.0230.09020.31
7.0.40.0070.08720.13
7.0.30.0070.08720.06
7.0.20.0130.06720.11
7.0.10.0070.04720.01
7.0.00.0030.08019.93
5.6.280.0000.07321.09
5.6.250.0100.04720.47
5.6.240.0230.06320.64
5.6.230.0100.07320.48
5.6.220.0030.05020.57
5.6.210.0070.08720.61
5.6.200.0100.07721.16
5.6.190.0030.05721.08
5.6.180.0130.04321.09
5.6.170.0070.07721.07
5.6.160.0170.07021.04
5.6.150.0070.08320.92
5.6.140.0100.07721.07
5.6.130.0070.07020.91
5.6.120.0130.08021.00
5.6.110.0070.08321.01
5.6.100.0100.07320.91
5.6.90.0070.05021.06
5.6.80.0100.07720.43
5.6.70.0100.07020.46
5.6.60.0130.07320.47
5.6.50.0070.07320.53
5.6.40.0200.05320.45
5.6.30.0100.07720.41
5.6.20.0100.07720.38
5.6.10.0100.08020.34
5.6.00.0170.07020.27
5.5.380.0000.05320.32
5.5.370.0100.07320.34
5.5.360.0030.07020.51
5.5.350.0030.09020.34
5.5.340.0030.07320.81
5.5.330.0030.06320.78
5.5.320.0100.07720.86
5.5.310.0000.09020.90
5.5.300.0000.07720.73
5.5.290.0100.07720.89
5.5.280.0170.06720.85
5.5.270.0130.07320.85
5.5.260.0130.07720.74
5.5.250.0100.08320.69
5.5.240.0000.08020.16
5.5.230.0130.07720.25
5.5.220.0130.07719.98
5.5.210.0000.08320.24
5.5.200.0070.07720.13
5.5.190.0030.08320.15
5.5.180.0030.08320.21
5.5.160.0100.07720.22
5.5.150.0170.07020.24
5.5.140.0030.06320.19
5.5.130.0000.08320.15
5.5.120.0030.07320.19
5.5.110.0100.05320.24
5.5.100.0100.07720.08
5.5.90.0030.08020.04
5.5.80.0130.07320.04
5.5.70.0070.06020.08
5.5.60.0000.08320.01
5.5.50.0100.06719.93
5.5.40.0030.08020.06
5.5.30.0100.07320.02
5.5.20.0070.07020.02
5.5.10.0070.05019.95
5.5.00.0070.04719.98
5.4.450.0070.04319.23
5.4.440.0070.08019.26
5.4.430.0070.07719.41
5.4.420.0100.07719.37
5.4.410.0100.06719.24
5.4.400.0100.07319.10
5.4.390.0070.07018.95
5.4.380.0000.08019.18
5.4.370.0000.06719.21
5.4.360.0070.07719.13
5.4.350.0030.08019.21
5.4.340.0100.04319.08
5.4.320.0100.05719.19
5.4.310.0030.08018.92
5.4.300.0130.07019.03
5.4.290.0070.07019.14
5.4.280.0130.07319.03
5.4.270.0130.06718.85
5.4.260.0030.05719.04
5.4.250.0070.07319.14
5.4.240.0070.07319.16
5.4.230.0130.06319.02
5.4.220.0000.08719.03
5.4.210.0200.05018.89
5.4.200.0100.07718.95
5.4.190.0070.07018.84
5.4.180.0000.08018.84
5.4.170.0030.08719.02
5.4.160.0130.06019.22
5.4.150.0070.08019.03
5.4.140.0030.07716.41
5.4.130.0000.07016.46
5.4.120.0100.07016.42
5.4.110.0070.05716.54
5.4.100.0070.08016.56
5.4.90.0070.07016.49
5.4.80.0200.06016.31
5.4.70.0100.06716.57
5.4.60.0070.07716.46
5.4.50.0030.07016.45
5.4.40.0070.05716.50
5.4.30.0130.07016.30
5.4.20.0100.06716.43
5.4.10.0100.07016.40
5.4.00.0130.03315.82
5.3.290.0070.07314.76
5.3.280.0000.04714.54
5.3.270.0100.07014.67
5.3.260.0030.04714.62
5.3.250.0000.05714.59
5.3.240.0100.04314.66
5.3.230.0070.07014.71
5.3.220.0100.07314.63
5.3.210.0070.07014.56
5.3.200.0100.07014.66
5.3.190.0030.08314.59
5.3.180.0070.05314.68
5.3.170.0100.07014.57
5.3.160.0100.07314.52
5.3.150.0070.07014.70
5.3.140.0130.07014.54
5.3.130.0070.07314.61
5.3.120.0070.07714.61
5.3.110.0070.07314.48
5.3.100.0030.08314.16
5.3.90.0100.06714.00
5.3.80.0070.04014.01
5.3.70.0070.07014.13
5.3.60.0100.03713.90
5.3.50.0130.07013.98
5.3.40.0070.06714.01
5.3.30.0200.05713.89
5.3.20.0030.07713.82
5.3.10.0070.07713.65
5.3.00.0100.06713.71
5.2.170.0100.05711.11
5.2.160.0030.06011.18
5.2.150.0030.05710.99
5.2.140.0030.06311.16
5.2.130.0070.05311.11
5.2.120.0170.04311.05
5.2.110.0030.03311.13
5.2.100.0130.05011.09
5.2.90.0030.06311.02
5.2.80.0000.06011.06
5.2.70.0100.06010.94
5.2.60.0100.04011.10
5.2.50.0130.05010.87
5.2.40.0030.06310.99
5.2.30.0030.06311.00
5.2.20.0000.06310.82
5.2.10.0030.06010.90
5.2.00.0030.05310.72
5.1.60.0100.05010.05
5.1.50.0070.04710.05
5.1.40.0070.0409.98
5.1.30.0000.06010.26
5.1.20.0030.05710.39
5.1.10.0100.04710.12
5.1.00.0100.03710.13
5.0.50.0000.0508.60
5.0.40.0070.0438.45
5.0.30.0070.0608.27
5.0.20.0070.0338.14
5.0.10.0030.0278.25
5.0.00.0000.0608.14
4.4.90.0030.0338.14
4.4.80.0000.0378.14
4.4.70.0000.0208.14
4.4.60.0130.0278.14
4.4.50.0030.0208.14
4.4.40.0000.0538.14
4.4.30.0030.0308.14
4.4.20.0030.0338.14
4.4.10.0000.0378.14
4.4.00.0070.0538.14
4.3.110.0000.0278.14
4.3.100.0030.0378.14
4.3.90.0070.0138.14
4.3.80.0070.0408.14
4.3.70.0030.0338.14
4.3.60.0000.0378.14
4.3.50.0070.0308.14
4.3.40.0030.0478.14
4.3.30.0070.0178.14
4.3.20.0030.0308.14
4.3.10.0000.0338.14
4.3.00.0070.0308.14

preferences:
50.39 ms | 401 KiB | 5 Q