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 = <<<REGEXP ! ^ (?: (?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 REGEXP; 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.60.0130.00718.43
8.3.50.0120.00821.02
8.3.40.0070.00718.96
8.3.30.0090.00620.16
8.3.20.0080.00020.47
8.3.10.0090.00021.05
8.3.00.0000.00822.44
8.2.180.0160.00616.75
8.2.170.0140.00022.96
8.2.160.0120.00420.37
8.2.150.0040.00424.18
8.2.140.0080.00424.66
8.2.130.0020.00526.16
8.2.120.0080.00020.94
8.2.110.0070.00321.00
8.2.100.0080.00817.74
8.2.90.0000.00817.91
8.2.80.0060.00319.07
8.2.70.0050.00318.05
8.2.60.0000.00818.03
8.2.50.0050.00318.10
8.2.40.0040.00420.63
8.2.30.0050.00219.17
8.2.20.0040.00417.80
8.2.10.0000.00817.84
8.2.00.0040.00417.77
8.1.280.0120.00325.92
8.1.270.0080.00023.99
8.1.260.0070.00026.35
8.1.250.0040.00428.09
8.1.240.0140.00022.08
8.1.230.0070.00420.89
8.1.220.0030.00617.74
8.1.210.0090.00018.77
8.1.200.0030.00517.35
8.1.190.0060.00317.23
8.1.180.0090.00018.10
8.1.170.0030.00618.64
8.1.160.0030.00622.09
8.1.150.0050.00218.70
8.1.140.0000.00719.61
8.1.130.0000.00717.75
8.1.120.0000.00717.48
8.1.110.0070.00017.39
8.1.100.0000.00717.38
8.1.90.0030.00617.37
8.1.80.0000.00717.52
8.1.70.0030.00317.39
8.1.60.0030.00617.63
8.1.50.0030.00617.54
8.1.40.0030.00617.50
8.1.30.0040.00417.48
8.1.20.0020.00517.74
8.1.10.0000.00717.55
8.1.00.0000.00717.49
8.0.300.0000.00819.96
8.0.290.0080.00016.75
8.0.280.0030.00318.38
8.0.270.0050.00317.29
8.0.260.0030.00316.84
8.0.250.0040.00417.07
8.0.240.0030.00617.01
8.0.230.0000.00717.05
8.0.220.0070.00017.02
8.0.210.0050.00316.97
8.0.200.0000.00617.09
8.0.190.0040.00416.94
8.0.180.0070.00017.05
8.0.170.0020.00516.97
8.0.160.0040.00416.96
8.0.150.0030.00517.02
8.0.140.0000.00816.92
8.0.130.0060.00313.50
8.0.120.0050.00216.94
8.0.110.0040.00416.98
8.0.100.0040.00417.05
8.0.90.0040.00417.04
8.0.80.0090.00617.05
8.0.70.0080.00017.05
8.0.60.0070.00016.98
8.0.50.0070.00016.96
8.0.30.0080.01217.22
8.0.20.0130.01217.40
8.0.10.0050.00216.91
8.0.00.0070.01116.80
7.4.330.0030.00316.89
7.4.320.0080.00016.60
7.4.300.0060.00016.59
7.4.290.0030.00316.62
7.4.280.0080.00016.73
7.4.270.0030.00316.46
7.4.260.0030.00313.40
7.4.250.0060.00316.51
7.4.240.0050.00216.71
7.4.230.0030.00316.70
7.4.220.0140.00416.71
7.4.210.0080.00916.66
7.4.200.0000.00716.49
7.4.190.0040.00416.50
7.4.160.0160.00316.50
7.4.150.0110.01117.40
7.4.140.0110.00817.86
7.4.130.0120.00516.63
7.4.120.0110.00916.68
7.4.110.0070.01116.77
7.4.100.0100.00716.74
7.4.90.0090.00916.69
7.4.80.0040.01419.39
7.4.70.0040.01316.66
7.4.60.0120.00916.42
7.4.50.0060.00316.87
7.4.40.0070.01122.77
7.4.30.0120.00616.61
7.4.00.0090.00915.02
7.3.330.0000.00513.47
7.3.320.0060.00013.38
7.3.310.0000.00616.44
7.3.300.0000.00716.42
7.3.290.0070.00716.32
7.3.280.0090.00916.38
7.3.270.0080.00817.40
7.3.260.0100.00918.24
7.3.250.0120.00716.38
7.3.240.0090.00916.40
7.3.230.0120.00416.39
7.3.210.0120.00616.36
7.3.200.0050.00719.39
7.3.190.0070.01016.36
7.3.180.0070.01016.39
7.3.170.0040.01616.52
7.3.160.0130.00316.45
7.3.120.0060.01114.99
7.3.110.0070.01115.06
7.3.100.0070.00715.10
7.3.90.0070.01014.76
7.3.80.0070.01015.06
7.3.70.0000.01414.86
7.3.60.0040.00915.02
7.3.50.0110.00414.99
7.3.40.0080.00614.59
7.3.30.0090.00314.70
7.3.20.0060.00616.81
7.3.10.0120.00316.51
7.3.00.0050.00816.70
7.2.330.0070.01116.59
7.2.320.0060.01316.73
7.2.310.0320.01316.68
7.2.300.0080.00816.64
7.2.290.0000.01816.64
7.2.250.0060.01515.11
7.2.240.0100.01015.33
7.2.230.0030.01215.19
7.2.220.0060.00914.98
7.2.210.0000.01515.27
7.2.200.0080.00815.27
7.2.190.0080.00515.13
7.2.180.0030.00715.14
7.2.170.0100.00315.11
7.2.130.0070.01016.60
7.2.120.0080.00816.85
7.2.110.0070.00716.63
7.2.100.0090.00816.83
7.2.90.0040.00716.85
7.2.80.0050.01016.77
7.2.70.0060.01016.95
7.2.60.0080.00616.91
7.2.50.0070.00716.85
7.2.40.0140.00517.04
7.2.30.0080.00516.92
7.2.20.0060.01116.71
7.2.10.0080.00516.99
7.2.00.0060.01017.76
7.1.330.0070.01016.02
7.1.320.0100.00315.64
7.1.310.0060.00315.89
7.1.300.0030.01015.71
7.1.290.0030.00615.66
7.1.280.0000.01315.63
7.1.270.0030.00715.59
7.1.260.0080.00815.81
7.1.250.0060.00615.67
7.1.200.0050.00315.94
7.1.100.0060.00617.65
7.1.70.0060.00916.95
7.1.60.0070.01719.17
7.1.50.0210.01834.56
7.1.00.0000.03722.51
7.0.200.0040.00416.54
7.0.140.0000.07722.04
7.0.100.0030.09020.08
7.0.90.0100.08020.04
7.0.80.0030.08019.98
7.0.70.0130.07719.95
7.0.60.0000.08019.99
7.0.50.0100.04720.30
7.0.40.0000.05320.04
7.0.30.0030.08720.08
7.0.20.0130.08020.12
7.0.10.0170.06720.14
7.0.00.0030.08020.11
5.6.280.0070.08721.14
5.6.250.0070.06020.68
5.6.240.0100.08320.78
5.6.230.0100.07020.73
5.6.220.0100.08020.61
5.6.210.0070.06320.71
5.6.200.0100.07721.16
5.6.190.0070.07721.07
5.6.180.0070.08720.98
5.6.170.0170.07021.05
5.6.160.0100.08021.07
5.6.150.0170.07321.07
5.6.140.0030.06321.10
5.6.130.0100.04321.06
5.6.120.0070.05021.05
5.6.110.0070.08321.15
5.6.100.0000.09021.03
5.6.90.0170.07721.02
5.6.80.0130.06320.50
5.6.70.0100.07720.36
5.6.60.0000.08020.41
5.6.50.0130.08020.36
5.6.40.0030.07320.29
5.6.30.0130.03020.30
5.6.20.0000.05020.39
5.6.10.0030.08320.47
5.6.00.0070.07320.32
5.5.380.0070.04720.36
5.5.370.0100.07320.39
5.5.360.0100.07020.50
5.5.350.0070.08720.44
5.5.340.0130.07320.81
5.5.330.0130.04020.89
5.5.320.0130.06320.88
5.5.310.0100.07720.84
5.5.300.0030.05320.84
5.5.290.0130.07720.85
5.5.280.0170.07720.79
5.5.270.0130.06020.83
5.5.260.0070.08020.94
5.5.250.0070.08020.69
5.5.240.0100.07020.23
5.5.230.0000.05320.28
5.5.220.0000.08020.25
5.5.210.0170.06720.27
5.5.200.0130.07320.27
5.5.190.0030.04020.20
5.5.180.0070.04320.15
5.5.160.0070.03320.20
5.5.150.0130.07020.01
5.5.140.0130.07320.14
5.5.130.0070.07020.29
5.5.120.0100.03020.19
5.5.110.0030.07720.23
5.5.100.0030.08020.04
5.5.90.0130.07020.18
5.5.80.0130.07020.07
5.5.70.0130.06720.12
5.5.60.0030.06720.15
5.5.50.0030.08019.98
5.5.40.0070.07020.08
5.5.30.0130.07720.08
5.5.20.0100.07020.16
5.5.10.0070.07720.13
5.5.00.0030.07320.05
5.4.450.0100.04719.23
5.4.440.0070.08319.54
5.4.430.0070.08319.55
5.4.420.0130.07019.27
5.4.410.0030.06019.32
5.4.400.0030.07318.95
5.4.390.0000.08719.16
5.4.380.0100.04719.13
5.4.370.0100.06319.14
5.4.360.0000.08319.09
5.4.350.0030.04019.11
5.4.340.0070.06018.85
5.4.320.0030.05719.00
5.4.310.0100.06718.90
5.4.300.0130.06719.13
5.4.290.0030.07319.22
5.4.280.0100.08018.92
5.4.270.0030.04018.90
5.4.260.0130.05019.18
5.4.250.0030.07719.04
5.4.240.0130.06719.08
5.4.230.0170.06019.20
5.4.220.0030.08019.07
5.4.210.0100.06318.86
5.4.200.0030.07319.23
5.4.190.0000.07019.03
5.4.180.0000.08318.87
5.4.170.0000.08019.17
5.4.160.0030.06719.21
5.4.150.0030.05318.88
5.4.140.0030.08016.45
5.4.130.0100.06716.45
5.4.120.0030.06016.47
5.4.110.0100.07316.38
5.4.100.0070.07316.32
5.4.90.0030.06716.39
5.4.80.0100.06716.31
5.4.70.0070.07316.46
5.4.60.0030.08716.46
5.4.50.0100.06016.45
5.4.40.0070.06316.43
5.4.30.0070.07016.32
5.4.20.0000.05316.36
5.4.10.0070.07316.46
5.4.00.0030.05715.86
5.3.290.0000.04014.73
5.3.280.0130.07014.70
5.3.270.0070.04314.72
5.3.260.0100.07714.59
5.3.250.0070.08014.66
5.3.240.0030.04314.67
5.3.230.0100.07314.56
5.3.220.0070.07314.52
5.3.210.0100.06714.49
5.3.200.0070.07314.52
5.3.190.0130.05714.50
5.3.180.0100.06714.61
5.3.170.0030.08014.59
5.3.160.0030.06014.67
5.3.150.0030.08014.55
5.3.140.0100.06714.52
5.3.130.0100.07314.55
5.3.120.0030.07314.66
5.3.110.0130.07314.61
5.3.100.0070.03714.13
5.3.90.0100.07314.03
5.3.80.0100.07014.00
5.3.70.0030.05714.07
5.3.60.0100.07014.13
5.3.50.0030.04714.00
5.3.40.0070.07714.00
5.3.30.0100.06313.93
5.3.20.0100.07313.74
5.3.10.0130.06013.57
5.3.00.0030.06013.53
5.2.170.0000.06711.17
5.2.160.0070.06711.00
5.2.150.0030.05311.00
5.2.140.0070.06711.21
5.2.130.0070.05711.05
5.2.120.0030.06311.09
5.2.110.0070.05010.93
5.2.100.0000.06711.09
5.2.90.0030.05711.14
5.2.80.0030.03310.89
5.2.70.0000.04711.07
5.2.60.0030.06711.07
5.2.50.0070.05710.98
5.2.40.0100.02710.98
5.2.30.0030.06310.83
5.2.20.0100.04710.98
5.2.10.0030.05010.86
5.2.00.0070.05010.74
5.1.60.0000.06310.00
5.1.50.0100.04710.04
5.1.40.0030.0439.96
5.1.30.0130.05310.39
5.1.20.0100.05310.25
5.1.10.0070.04010.12
5.1.00.0030.03710.12
5.0.50.0030.0279.24
5.0.40.0070.0339.24
5.0.30.0100.0579.24
5.0.20.0000.0379.24
5.0.10.0000.0509.24
5.0.00.0030.0479.24
4.4.90.0030.0339.24
4.4.80.0030.0339.24
4.4.70.0030.0279.24
4.4.60.0030.0339.24
4.4.50.0030.0339.24
4.4.40.0000.0579.24
4.4.30.0070.0279.24
4.4.20.0030.0179.24
4.4.10.0070.0339.24
4.4.00.0000.0539.24
4.3.110.0070.0209.24
4.3.100.0070.0339.24
4.3.90.0000.0379.24
4.3.80.0000.0309.24
4.3.70.0030.0339.24
4.3.60.0070.0309.24
4.3.50.0030.0379.24
4.3.40.0030.0539.24
4.3.30.0000.0409.24
4.3.20.0000.0209.24
4.3.10.0070.0309.24
4.3.00.0000.0379.24

preferences:
52.96 ms | 401 KiB | 5 Q