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://user:pass@foo.com:123456/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.70.0130.00616.75
8.3.60.0030.01318.43
8.3.50.0110.00921.27
8.3.40.0070.01418.96
8.3.30.0070.01120.20
8.3.20.0080.00020.61
8.3.10.0000.00821.08
8.3.00.0090.00022.43
8.2.180.0090.01316.75
8.2.170.0120.00322.96
8.2.160.0090.01218.83
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0060.00326.16
8.2.120.0000.00720.89
8.2.110.0060.00319.16
8.2.100.0080.00317.78
8.2.90.0030.00619.23
8.2.80.0060.00318.04
8.2.70.0040.00417.38
8.2.60.0040.00418.04
8.2.50.0080.00018.07
8.2.40.0000.00817.91
8.2.30.0000.00819.52
8.2.20.0040.00417.67
8.2.10.0040.00417.66
8.2.00.0030.00517.65
8.1.280.0130.00625.92
8.1.270.0040.00423.99
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0090.00024.02
8.1.230.0000.01120.92
8.1.220.0040.00418.77
8.1.210.0000.00819.16
8.1.200.0100.00017.23
8.1.190.0000.00817.30
8.1.180.0040.00418.10
8.1.170.0060.00318.65
8.1.160.0040.00418.86
8.1.150.0040.00418.61
8.1.140.0020.00517.48
8.1.130.0030.00317.79
8.1.120.0040.00417.47
8.1.110.0040.00417.39
8.1.100.0000.00717.38
8.1.90.0000.00717.50
8.1.80.0080.00017.50
8.1.70.0000.00817.44
8.1.60.0040.00417.61
8.1.50.0000.00717.56
8.1.40.0030.00617.54
8.1.30.0000.00817.66
8.1.20.0030.00517.70
8.1.10.0040.00417.47
8.1.00.0070.00017.49
8.0.300.0000.00719.79
8.0.290.0000.00717.05
8.0.280.0070.00018.43
8.0.270.0070.00017.30
8.0.260.0070.00016.91
8.0.250.0060.00317.09
8.0.240.0060.00317.07
8.0.230.0040.00416.93
8.0.220.0030.00317.03
8.0.210.0030.00317.02
8.0.200.0030.00316.91
8.0.190.0000.00816.95
8.0.180.0000.00717.06
8.0.170.0000.00716.91
8.0.160.0000.00816.99
8.0.150.0070.00017.01
8.0.140.0040.00416.93
8.0.130.0090.00013.45
8.0.120.0000.00816.94
8.0.110.0000.00717.06
8.0.100.0030.00516.96
8.0.90.0000.00816.94
8.0.80.0090.00616.91
8.0.70.0000.00816.84
8.0.60.0070.00016.99
8.0.50.0000.00716.89
8.0.30.0090.00917.07
8.0.20.0100.01117.40
8.0.10.0000.00717.04
8.0.00.0120.00616.75
7.4.330.0000.00616.77
7.4.320.0030.00516.69
7.4.300.0030.00316.64
7.4.290.0000.00816.69
7.4.280.0080.00016.58
7.4.270.0070.00016.71
7.4.260.0050.00013.43
7.4.250.0030.00616.56
7.4.240.0000.00716.72
7.4.230.0040.00416.72
7.4.220.0090.00916.64
7.4.210.0070.01016.68
7.4.200.0000.00716.81
7.4.190.0000.00716.78
7.4.160.0080.00816.52
7.4.150.0130.01317.40
7.4.140.0110.01017.86
7.4.130.0090.00916.61
7.4.120.0090.00816.67
7.4.110.0090.01016.46
7.4.100.0070.01016.60
7.4.90.0200.00416.66
7.4.80.0140.00719.39
7.4.70.0090.00816.64
7.4.60.0140.00316.59
7.4.50.0030.00616.50
7.4.40.0030.01222.77
7.4.30.0090.00916.57
7.4.00.0050.01214.88
7.3.330.0020.00213.21
7.3.320.0050.00013.47
7.3.310.0070.00016.43
7.3.300.0000.00716.43
7.3.290.0000.01316.32
7.3.280.0050.01616.38
7.3.270.0090.00917.40
7.3.260.0110.00618.24
7.3.250.0080.01116.38
7.3.240.0060.01016.37
7.3.230.0030.01416.58
7.3.210.0090.00816.71
7.3.200.0110.01419.39
7.3.190.0120.01216.59
7.3.180.0090.00616.38
7.3.170.0120.00916.39
7.3.160.0160.00616.48
7.3.120.0100.00714.81
7.3.110.0090.00714.77
7.3.100.0050.01014.90
7.3.90.0070.00614.70
7.3.80.0110.00314.76
7.3.70.0040.01014.80
7.3.60.0030.01314.91
7.3.50.0100.00414.76
7.3.40.0070.00414.81
7.3.30.0090.00314.60
7.3.20.0000.00916.63
7.3.10.0060.00616.63
7.3.00.0030.00916.55
7.2.330.0140.01016.73
7.2.320.0130.01016.59
7.2.310.0160.00316.45
7.2.300.0140.00316.74
7.2.290.0030.01316.42
7.2.250.0090.00915.18
7.2.240.0050.01315.12
7.2.230.0050.01315.26
7.2.220.0060.00814.95
7.2.210.0060.01015.02
7.2.200.0050.00715.13
7.2.190.0060.00515.13
7.2.180.0060.00815.14
7.2.170.0080.00515.20
7.2.160.0000.00915.28
7.2.150.0110.00416.98
7.2.140.0040.00416.87
7.2.130.0040.00717.01
7.2.120.0070.00717.14
7.2.110.0060.00317.09
7.2.100.0000.01616.88
7.2.90.0070.00417.07
7.2.80.0050.00517.13
7.2.70.0080.00417.03
7.2.60.0040.01116.80
7.2.50.0030.00616.96
7.2.40.0060.00816.84
7.2.30.0040.01116.72
7.2.20.0060.00916.99
7.2.10.0040.01116.96
7.2.00.0040.01216.88
7.1.330.0100.00515.76
7.1.320.0050.00615.65
7.1.310.0060.00615.70
7.1.300.0060.00715.68
7.1.290.0090.00515.63
7.1.280.0050.00815.67
7.1.270.0070.00515.83
7.1.260.0050.00615.87
7.1.250.0000.01115.81
7.1.100.0060.00618.29
7.1.70.0000.00816.95
7.1.60.0060.01919.17
7.1.50.0280.01134.80
7.1.00.0070.03022.51
7.0.200.0070.00316.89
7.0.140.0030.06722.09
7.0.100.0130.05720.23
7.0.90.0230.06019.96
7.0.80.0330.04019.91
7.0.70.0470.07719.95
7.0.60.0230.08319.96
7.0.50.0200.08320.39
7.0.40.0030.08320.14
7.0.30.0070.06320.09
7.0.20.0070.07720.03
7.0.10.0100.07320.10
7.0.00.0030.08720.09
5.6.280.0030.07321.13
5.6.250.0100.07320.70
5.6.240.0100.07720.53
5.6.230.0100.07720.70
5.6.220.0100.08320.51
5.6.210.0030.07320.59
5.6.200.0130.05721.11
5.6.190.0130.08321.05
5.6.180.0070.08321.11
5.6.170.0070.05020.97
5.6.160.0070.05021.06
5.6.150.0000.08321.11
5.6.140.0130.08020.97
5.6.130.0030.06021.06
5.6.120.0070.05720.97
5.6.110.0100.05721.02
5.6.100.0100.04721.02
5.6.90.0070.05721.17
5.6.80.0000.05320.51
5.6.70.0070.07720.54
5.6.60.0100.05020.43
5.6.50.0030.06320.42
5.6.40.0130.07720.44
5.6.30.0100.05720.49
5.6.20.0030.08720.48
5.6.10.0070.07720.39
5.6.00.0100.07720.38
5.5.380.0030.08320.37
5.5.370.0130.08020.51
5.5.360.0130.07020.43
5.5.350.0030.07320.41
5.5.340.0070.08020.93
5.5.330.0000.10320.75
5.5.320.0070.08720.90
5.5.310.0130.07320.92
5.5.300.0130.05320.77
5.5.290.0130.04020.91
5.5.280.0130.07720.66
5.5.270.0100.08020.65
5.5.260.0030.08320.80
5.5.250.0170.07020.73
5.5.240.0070.07320.20
5.5.230.0130.07320.04
5.5.220.0070.06020.19
5.5.210.0030.05720.17
5.5.200.0030.08320.30
5.5.190.0070.06320.20
5.5.180.0100.04320.29
5.5.160.0100.05320.21
5.5.150.0130.04720.14
5.5.140.0100.06719.98
5.5.130.0170.07720.29
5.5.120.0200.03720.17
5.5.110.0130.07020.27
5.5.100.0100.04020.09
5.5.90.0030.08320.09
5.5.80.0030.07720.14
5.5.70.0200.03020.08
5.5.60.0030.05720.05
5.5.50.0070.07720.10
5.5.40.0130.04320.07
5.5.30.0130.07319.97
5.5.20.0030.08320.12
5.5.10.0070.07319.97
5.5.00.0070.07720.13
5.4.450.0070.06319.42
5.4.440.0100.07719.56
5.4.430.0200.04719.20
5.4.420.0100.07319.37
5.4.410.0100.06319.32
5.4.400.0070.08319.14
5.4.390.0030.08019.05
5.4.380.0000.06719.11
5.4.370.0170.05018.89
5.4.360.0100.08019.14
5.4.350.0170.06719.04
5.4.340.0130.07319.18
5.4.320.0070.04319.04
5.4.310.0100.07319.06
5.4.300.0030.06018.85
5.4.290.0130.06719.18
5.4.280.0000.07719.02
5.4.270.0070.06019.23
5.4.260.0170.05319.15
5.4.250.0030.05718.94
5.4.240.0070.07319.02
5.4.230.0130.07318.86
5.4.220.0000.03718.90
5.4.210.0070.06018.94
5.4.200.0170.06718.87
5.4.190.0100.06718.86
5.4.180.0100.07719.04
5.4.170.0130.05019.13
5.4.160.0000.08019.10
5.4.150.0170.06319.07
5.4.140.0030.08016.51
5.4.130.0070.07316.50
5.4.120.0100.04316.49
5.4.110.0000.04016.52
5.4.100.0070.04316.52
5.4.90.0030.04316.45
5.4.80.0030.04316.48
5.4.70.0030.03716.54
5.4.60.0030.03716.26
5.4.50.0000.04016.36
5.4.40.0100.03016.42
5.4.30.0100.03016.33
5.4.20.0030.03016.36
5.4.10.0000.04016.38
5.4.00.0030.03315.70
5.3.290.0100.04314.62
5.3.280.0070.07314.66
5.3.270.0070.07714.59
5.3.260.0030.08014.69
5.3.250.0100.06314.67
5.3.240.0100.07714.74
5.3.230.0100.08714.71
5.3.220.0070.07014.69
5.3.210.0030.04314.70
5.3.200.0000.04014.58
5.3.190.0030.03714.53
5.3.180.0030.04014.70
5.3.170.0030.03714.70
5.3.160.0000.04014.54
5.3.150.0030.03714.48
5.3.140.0100.03014.55
5.3.130.0030.04014.61
5.3.120.0030.03714.49
5.3.110.0000.04014.52
5.3.100.0030.03013.98
5.3.90.0070.03314.13
5.3.80.0000.03714.04
5.3.70.0030.03014.13
5.3.60.0030.03313.93
5.3.50.0030.04013.96
5.3.40.0000.04013.92
5.3.30.0030.03713.91
5.3.20.0100.06013.61
5.3.10.0100.02713.66
5.3.00.0100.03313.67
5.2.170.0000.03310.98
5.2.160.0000.03010.97
5.2.150.0000.03010.99
5.2.140.0070.02710.93
5.2.130.0000.03011.15
5.2.120.0000.03011.09
5.2.110.0000.03010.98
5.2.100.0030.02311.17
5.2.90.0000.03010.89
5.2.80.0000.03310.93
5.2.70.0100.02311.08
5.2.60.0070.02311.09
5.2.50.0000.03010.80
5.2.40.0030.02711.06
5.2.30.0030.02310.80
5.2.20.0000.03310.80
5.2.10.0000.03010.93
5.2.00.0100.02010.74
5.1.60.0000.02010.03
5.1.50.0000.02010.01
5.1.40.0000.0309.97
5.1.30.0000.02710.34
5.1.20.0000.02710.37
5.1.10.0030.02710.08
5.1.00.0000.04010.11
5.0.50.0000.0208.61
5.0.40.0000.0278.61
5.0.30.0030.0238.61
5.0.20.0030.0138.61
5.0.10.0000.0178.61
5.0.00.0030.0278.61
4.4.90.0000.0138.61
4.4.80.0000.0138.61
4.4.70.0000.0138.61
4.4.60.0000.0178.61
4.4.50.0030.0108.61
4.4.40.0000.0208.61
4.4.30.0000.0138.61
4.4.20.0030.0138.61
4.4.10.0000.0138.61
4.4.00.0030.0208.61
4.3.110.0000.0138.61
4.3.100.0030.0108.61
4.3.90.0000.0138.61
4.3.80.0000.0378.61
4.3.70.0000.0138.61
4.3.60.0000.0178.61
4.3.50.0030.0108.61
4.3.40.0000.0208.61
4.3.30.0000.0138.61
4.3.20.0000.0178.61
4.3.10.0000.0178.61
4.3.00.0000.0138.61

preferences:
49.18 ms | 401 KiB | 5 Q