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_REQUIRE_SCHEME = 0x100; const PHP_URL_DISALLOW_EMPTY_AUTHORITY = 0x200; function parse_url($url, $flags = 0) { 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 = '! ^ (?: (?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'; if (!preg_match($pattern, trim($url), $matches)) { return false; } if ($flags & PHP_URL_REQUIRE_SCHEME) { if (!isset($matches['scheme']) || $matches['scheme'] === '') { return false; } } if ($flags & PHP_URL_DISALLOW_EMPTY_AUTHORITY) { if (isset($matches['hasauthority']) && $matches['hasauthority'] && (!isset($matches['host']) || $matches['host'] === '')) { return false; } } // Default to all components, allowing the above flags // to be specified without specifying the components $flags = $flags & 0xFF ?: 0xFF; $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://foo.com/test?thing=stuff#fragment'; var_dump(parse_url($url, -1));

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.0120.00318.55
8.3.50.0110.00621.21
8.3.40.0070.01419.09
8.3.30.0090.00620.07
8.3.20.0060.00320.77
8.3.10.0050.00321.22
8.3.00.0050.00322.47
8.2.180.0000.01618.66
8.2.170.0070.00722.96
8.2.160.0070.00720.38
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0030.00526.16
8.2.120.0040.00421.06
8.2.110.0030.00719.45
8.2.100.0120.00018.09
8.2.90.0000.00919.21
8.2.80.0030.00618.04
8.2.70.0060.00317.88
8.2.60.0080.00018.05
8.2.50.0000.00818.07
8.2.40.0080.00018.16
8.2.30.0000.00719.45
8.2.20.0000.00717.93
8.2.10.0040.00418.00
8.2.00.0030.00517.86
8.1.280.0080.00825.92
8.1.270.0040.00423.99
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0030.00623.92
8.1.230.0090.00320.89
8.1.220.0030.00518.77
8.1.210.0040.00419.20
8.1.200.0040.00417.50
8.1.190.0040.00417.64
8.1.180.0050.00318.10
8.1.170.0000.00818.91
8.1.160.0050.00219.00
8.1.150.0070.00018.84
8.1.140.0040.00417.64
8.1.130.0000.00817.93
8.1.120.0000.00717.72
8.1.110.0000.00817.64
8.1.100.0050.00317.64
8.1.90.0000.00817.61
8.1.80.0000.00717.53
8.1.70.0030.00317.64
8.1.60.0000.00817.73
8.1.50.0040.00417.72
8.1.40.0060.00317.69
8.1.30.0030.00617.71
8.1.20.0030.00517.76
8.1.10.0040.00417.76
8.1.00.0060.00317.66
8.0.300.0040.00420.16
8.0.290.0060.00317.30
8.0.280.0000.00718.43
8.0.270.0040.00417.32
8.0.260.0000.00716.99
8.0.250.0000.00817.14
8.0.240.0030.00617.10
8.0.230.0040.00417.02
8.0.220.0000.00717.10
8.0.210.0000.00717.05
8.0.200.0060.00017.05
8.0.190.0040.00417.12
8.0.180.0000.00717.09
8.0.170.0040.00417.05
8.0.160.0070.00017.02
8.0.150.0000.00817.02
8.0.140.0000.00717.11
8.0.130.0060.00313.54
8.0.120.0040.00416.90
8.0.110.0040.00417.11
8.0.100.0070.00016.90
8.0.90.0030.00517.07
8.0.80.0100.00717.14
8.0.70.0050.00317.07
8.0.60.0050.00217.03
8.0.50.0070.00017.02
8.0.30.0110.00817.38
8.0.20.0110.01117.40
8.0.10.0030.00517.14
8.0.00.0080.01317.07
7.4.330.0030.00316.69
7.4.320.0070.00016.84
7.4.300.0030.00316.83
7.4.290.0000.00816.90
7.4.280.0000.00916.76
7.4.270.0000.00716.75
7.4.260.0000.00613.47
7.4.250.0020.00516.75
7.4.240.0040.00416.62
7.4.230.0030.00316.86
7.4.220.0090.01216.88
7.4.210.0080.00616.75
7.4.200.0060.00016.68
7.4.190.0040.00416.79
7.4.160.0130.01016.86
7.4.150.0290.02717.40
7.4.140.0040.01417.86
7.4.130.0090.00816.86
7.4.120.0100.00816.77
7.4.110.0130.00716.73
7.4.100.0140.00716.84
7.4.90.0120.00616.59
7.4.80.0120.00619.39
7.4.70.0030.01416.86
7.4.60.0130.00716.79
7.4.50.0070.00016.54
7.4.40.0090.00622.77
7.4.30.0060.01116.57
7.4.00.0110.00615.30
7.3.330.0000.00513.48
7.3.320.0000.00513.40
7.3.310.0000.00716.54
7.3.300.0000.00716.59
7.3.290.0060.00816.62
7.3.280.0080.01116.55
7.3.270.0190.00717.40
7.3.260.0100.00818.24
7.3.250.0090.00916.83
7.3.240.0140.00716.50
7.3.230.0150.00416.60
7.3.210.0060.01016.64
7.3.200.0060.01319.39
7.3.190.0050.01416.63
7.3.180.0130.00316.52
7.3.170.0130.00316.71
7.3.160.0110.01116.50
7.3.120.0100.00715.05
7.3.110.0070.01015.05
7.3.100.0150.00014.91
7.3.90.0060.00914.95
7.3.80.0030.01314.99
7.3.70.0060.00915.09
7.3.60.0000.01515.12
7.3.50.0130.00015.12
7.3.40.0090.00315.12
7.3.30.0030.00715.05
7.3.20.0030.01216.76
7.3.10.0110.00516.84
7.3.00.0110.00516.64
7.2.330.0150.00316.92
7.2.320.0030.01416.96
7.2.310.0140.00516.93
7.2.300.0100.00716.84
7.2.290.0080.00917.10
7.2.250.0030.01015.46
7.2.240.0060.01015.46
7.2.230.0060.01215.27
7.2.220.0110.00715.14
7.2.210.0100.00315.27
7.2.200.0130.00315.13
7.2.190.0100.00715.41
7.2.180.0030.00715.30
7.2.170.0180.00015.36
7.2.130.0060.01516.55
7.2.120.0060.01416.72
7.2.110.0100.01016.53
7.2.100.0080.01716.58
7.2.90.0040.01816.70
7.2.80.0110.01116.90
7.2.70.0150.00716.95
7.2.60.0120.00616.72
7.2.50.0130.00616.69
7.2.40.0100.00717.32
7.2.30.0090.00917.27
7.2.20.0070.01016.66
7.2.10.0150.00316.85
7.2.00.0060.00818.20
7.1.330.0120.00316.11
7.1.320.0040.01416.21
7.1.310.0000.01116.11
7.1.300.0040.01515.66
7.1.290.0070.00415.98
7.1.280.0070.00715.80
7.1.270.0030.00915.95
7.1.260.0000.01715.84
7.1.250.0180.00315.42
7.1.100.0060.00618.52
7.1.70.0000.00817.53
7.1.60.0110.01519.17
7.1.50.0140.01435.04
7.1.00.0100.04022.40
7.0.200.0040.00416.84
7.0.140.0100.06722.23
7.0.80.0370.09019.91
7.0.70.0670.06720.04
7.0.60.0530.08719.91
7.0.50.0500.06020.24
7.0.40.0100.04320.08
7.0.30.0100.08719.96
7.0.20.0130.07720.14
7.0.10.0070.08320.13
7.0.00.0070.09020.07
5.6.280.0030.07320.80
5.6.230.0070.08020.70
5.6.220.0070.06720.79
5.6.210.0100.08320.59
5.6.200.0100.08021.05
5.6.190.0100.08321.06
5.6.180.0100.08020.95
5.6.170.0000.09020.99
5.6.160.0030.05321.14
5.6.150.0100.07721.10
5.6.140.0100.07720.97
5.6.130.0100.08321.10
5.6.120.0100.04721.15
5.6.110.0100.08321.18
5.6.100.0000.05721.12
5.6.90.0100.08020.93
5.6.80.0170.06320.43
5.6.70.0030.05320.50
5.6.60.0070.05020.33
5.6.50.0130.08320.50
5.6.40.0100.05020.55
5.6.30.0170.06720.32
5.6.20.0070.07320.47
5.6.10.0030.04720.48
5.6.00.0100.08020.37
5.5.370.0070.04720.38
5.5.360.0100.07320.41
5.5.350.0030.08720.44
5.5.340.0170.06720.83
5.5.330.0070.08320.77
5.5.320.0100.07720.91
5.5.310.0100.08020.91
5.5.300.0030.08320.94
5.5.290.0130.07020.88
5.5.280.0030.05020.77
5.5.270.0170.04720.90
5.5.260.0130.07720.91
5.5.250.0130.07720.74
5.5.240.0070.07720.20
5.5.230.0070.07320.29
5.5.220.0130.07020.31
5.5.210.0030.09020.17
5.5.200.0170.06720.01
5.5.190.0200.03720.20
5.5.180.0070.05020.00
5.5.160.0070.04320.16
5.5.150.0030.05320.30
5.5.140.0070.04720.09
5.5.130.0100.04720.20
5.5.120.0100.08020.26
5.5.110.0070.04720.23
5.5.100.0030.05320.11
5.5.90.0070.08020.09
5.5.80.0100.07720.13
5.5.70.0130.04020.11
5.5.60.0000.08020.16
5.5.50.0070.05020.17
5.5.40.0100.06020.10
5.5.30.0030.05720.16
5.5.20.0200.06719.97
5.5.10.0130.07019.99
5.5.00.0100.03719.98
5.4.450.0030.08319.38
5.4.440.0070.10019.20
5.4.430.0070.07719.50
5.4.420.0100.07719.37
5.4.410.0000.07319.36
5.4.400.0100.04019.03
5.4.390.0100.06019.04
5.4.380.0070.07319.03
5.4.370.0030.06719.13
5.4.360.0100.07019.22
5.4.350.0100.05719.18
5.4.340.0030.04719.13
5.4.320.0030.04719.16
5.4.310.0130.03719.15
5.4.300.0170.06719.18
5.4.290.0030.04718.84
5.4.280.0130.07319.04
5.4.270.0100.07019.16
5.4.260.0100.04719.04
5.4.250.0130.07018.89
5.4.240.0070.06318.87
5.4.230.0130.07018.90
5.4.220.0030.08719.02
5.4.210.0070.04019.17
5.4.200.0030.03718.87
5.4.190.0030.06718.86
5.4.180.0030.07019.15
5.4.170.0030.06719.02
5.4.160.0000.07719.11
5.4.150.0030.04719.07
5.4.140.0000.06016.48
5.4.130.0070.07016.24
5.4.120.0070.06316.50
5.4.110.0100.06716.56
5.4.100.0170.02716.39
5.4.90.0130.04016.38
5.4.80.0100.06716.38
5.4.70.0100.07316.54
5.4.60.0030.07316.46
5.4.50.0000.04316.41
5.4.40.0100.05316.45
5.4.30.0170.04716.39
5.4.20.0030.07716.43
5.4.10.0070.07016.30
5.4.00.0030.05715.89
5.3.290.0100.04714.65
5.3.280.0170.06014.73
5.3.270.0000.04314.75
5.3.260.0100.06714.72
5.3.250.0070.06714.67
5.3.240.0100.03714.63
5.3.230.0030.07014.63
5.3.220.0030.07014.50
5.3.210.0070.05014.57
5.3.200.0030.04014.71
5.3.190.0170.05714.69
5.3.180.0100.06014.51
5.3.170.0100.07014.59
5.3.160.0030.07714.57
5.3.150.0100.05714.68
5.3.140.0030.07714.52
5.3.130.0030.07714.55
5.3.120.0100.07014.52
5.3.110.0000.08714.69
5.3.100.0070.04314.03
5.3.90.0030.07314.01
5.3.80.0170.06714.09
5.3.70.0070.05713.93
5.3.60.0100.06714.11
5.3.50.0100.07013.84
5.3.40.0100.07013.83
5.3.30.0130.07013.84
5.3.20.0070.07013.61
5.3.10.0070.06713.67
5.3.00.0070.06713.66
5.2.170.0100.06311.63
5.2.160.0100.05011.63
5.2.150.0100.06011.63
5.2.140.0100.06311.63
5.2.130.0070.05711.63
5.2.120.0070.05311.63
5.2.110.0000.06711.63
5.2.100.0100.05711.63
5.2.90.0070.03711.63
5.2.80.0100.05311.63
5.2.70.0100.05711.63
5.2.60.0100.05311.63
5.2.50.0100.04711.63
5.2.40.0030.04011.63
5.2.30.0100.05711.63
5.2.20.0030.07011.63
5.2.10.0030.06011.63
5.2.00.0030.05711.63
5.1.60.0070.05011.63
5.1.50.0070.05711.63
5.1.40.0030.05711.63
5.1.30.0030.05711.63
5.1.20.0030.06011.63
5.1.10.0000.05011.63
5.1.00.0030.05311.63
5.0.50.0070.04711.63
5.0.40.0000.04711.63
5.0.30.0030.06011.63
5.0.20.0000.05011.63
5.0.10.0000.04011.63
5.0.00.0070.06311.63
4.4.90.0030.03311.63
4.4.80.0000.03711.63
4.4.70.0100.03011.63
4.4.60.0000.03011.63
4.4.50.0000.02711.63
4.4.40.0030.05311.63
4.4.30.0000.02711.63
4.4.20.0000.03711.63
4.4.10.0000.03711.63
4.4.00.0000.05711.63
4.3.110.0000.03711.63
4.3.100.0030.02311.63
4.3.90.0030.03311.63
4.3.80.0030.04711.63
4.3.70.0000.03011.63
4.3.60.0030.03311.63
4.3.50.0000.02311.63
4.3.40.0030.05011.63
4.3.30.0030.03011.63
4.3.20.0030.03011.63
4.3.10.0000.03711.63
4.3.00.0000.03011.63

preferences:
49.44 ms | 401 KiB | 5 Q