3v4l.org

run code in 300+ PHP versions simultaneously
<?php function new_parse_url($url, $component = -1, $strict = false) { 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+.\-]* ) [:] # scheme is mandatory, and followed by a : (?: [/][/] # // indicates that this component is the authority (?: (?P<user> [^:@/]+ ) (?: [:] (?P<pass> [^:@/]+ ) )? [@] )? # auth details are optional (?P<host> [^:/]* ) # host is mandatory. Technically it should be at least 1 char, but PHP has # internal schemes that violate this rule and as much as I dislike it, I # feel that we should pass this (?: [:] (?P<port> [0-9]+ ) )? # port is simply a sequence of decimal digits (?= [/?#]|$ ) # path must be missing or begin with / if authority is present )? (?P<path> [^?#]+ )? # path is everything up to the query/fragment (?: [?] (?P<query> [^#]+ ) )? # query is optional (?: [#] (?P<fragment> .+ ) )? # fragment is optional $ !xi REGEXP; if (!$strict) { return parse_url($url, $component); } if (!preg_match($pattern, $url, $matches)) { return false; } if (isset($map[$component])) { return $matches[$map[$component]]; } $result = []; foreach ($map as $component) { if (isset($matches[$component]) && $matches[$component] !== '') { $result[$component] = $matches[$component]; } } return $result; } $url = 'http://user:pass@foo.com/test?thing=stuff#fragment'; print_r(new_parse_url($url, -1, true));

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.0140.00718.43
8.3.50.0050.01121.33
8.3.40.0070.01418.79
8.3.30.0070.00720.18
8.3.20.0080.00020.73
8.3.10.0000.00821.05
8.3.00.0040.00422.45
8.2.180.0140.00716.75
8.2.170.0060.00922.96
8.2.160.0070.00720.44
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0050.00226.16
8.2.120.0070.00021.12
8.2.110.0060.00319.35
8.2.100.0090.00317.84
8.2.90.0080.00019.36
8.2.80.0050.00318.00
8.2.70.0060.00317.61
8.2.60.0040.00418.04
8.2.50.0050.00318.07
8.2.40.0030.00618.16
8.2.30.0040.00419.61
8.2.20.0090.00018.02
8.2.10.0040.00417.81
8.2.00.0020.00517.98
8.1.280.0110.01125.92
8.1.270.0000.00723.99
8.1.260.0070.00026.35
8.1.250.0070.00028.09
8.1.240.0050.00523.96
8.1.230.0040.00821.01
8.1.220.0040.00418.77
8.1.210.0050.00319.22
8.1.200.0030.00717.60
8.1.190.0000.00817.66
8.1.180.0080.00018.10
8.1.170.0080.00018.78
8.1.160.0040.00418.90
8.1.150.0060.00318.86
8.1.140.0080.00017.58
8.1.130.0080.00017.85
8.1.120.0040.00417.68
8.1.110.0040.00417.54
8.1.100.0040.00417.64
8.1.90.0030.00717.67
8.1.80.0000.00717.66
8.1.70.0050.00317.63
8.1.60.0030.00617.79
8.1.50.0000.00717.72
8.1.40.0050.00517.71
8.1.30.0040.00417.71
8.1.20.0000.00817.68
8.1.10.0040.00417.81
8.1.00.0060.00317.60
8.0.300.0000.00820.03
8.0.290.0040.00417.29
8.0.280.0030.00318.50
8.0.270.0030.00317.27
8.0.260.0000.00717.11
8.0.250.0030.00517.20
8.0.240.0000.00817.21
8.0.230.0000.00717.16
8.0.220.0070.00016.98
8.0.210.0000.00717.00
8.0.200.0000.00717.17
8.0.190.0030.00617.15
8.0.180.0040.00417.06
8.0.170.0040.00417.20
8.0.160.0040.00417.09
8.0.150.0040.00417.02
8.0.140.0000.00817.01
8.0.130.0030.00313.57
8.0.120.0040.00417.14
8.0.110.0000.00817.14
8.0.100.0070.00016.92
8.0.90.0000.00717.04
8.0.80.0070.01417.21
8.0.70.0040.00417.04
8.0.60.0000.00817.02
8.0.50.0000.00817.07
8.0.30.0140.00517.40
8.0.20.0080.01017.49
8.0.10.0000.00717.38
8.0.00.0090.00917.15
7.4.330.0020.00216.87
7.4.320.0040.00416.80
7.4.300.0000.00716.76
7.4.290.0030.00316.75
7.4.280.0030.00316.88
7.4.270.0080.00016.89
7.4.260.0000.00513.54
7.4.250.0080.00016.77
7.4.240.0040.00416.71
7.4.230.0030.00316.75
7.4.220.0150.00516.76
7.4.210.0050.00916.84
7.4.200.0030.00316.78
7.4.190.0040.00416.94
7.4.160.0150.00416.75
7.4.150.0100.01417.40
7.4.140.0100.00917.86
7.4.130.0030.01316.74
7.4.120.0030.01516.78
7.4.110.0160.00816.75
7.4.100.0140.00716.82
7.4.90.0100.01016.65
7.4.80.0110.01019.39
7.4.70.0070.01016.54
7.4.60.0150.00316.88
7.4.50.0050.00016.57
7.4.40.0080.00822.77
7.4.30.0030.01316.66
7.4.00.0070.00715.16
7.3.330.0000.00613.56
7.3.320.0030.00313.62
7.3.310.0000.00716.71
7.3.300.0030.00316.64
7.3.290.0130.00716.58
7.3.280.0070.01016.62
7.3.270.0180.00617.40
7.3.260.0140.00818.24
7.3.250.0260.01816.57
7.3.240.0100.01316.70
7.3.230.0040.01316.74
7.3.210.0030.01416.70
7.3.200.0160.00819.39
7.3.190.0070.01016.70
7.3.180.0090.00916.56
7.3.170.0030.01916.73
7.3.160.0130.00316.90
7.3.120.0060.00915.19
7.3.10.0170.00916.37
7.3.00.0200.00816.84
7.2.330.0140.01116.83
7.2.320.0030.01416.93
7.2.310.0080.01216.93
7.2.300.0160.00016.69
7.2.290.0070.01016.86
7.2.130.0180.01117.02
7.2.120.0170.01216.90
7.2.110.0200.00317.24
7.2.100.0160.00616.95
7.2.90.0130.00717.23
7.2.80.0230.01017.07
7.2.70.0210.00716.95
7.2.60.0180.00416.84
7.2.50.0140.01016.86
7.2.40.0110.01116.73
7.2.30.0200.01316.96
7.2.20.0160.00717.10
7.2.10.0210.01417.16
7.2.00.0080.01018.40
7.1.250.0120.01515.81
7.1.100.0060.00618.38
7.1.70.0050.00217.52
7.1.60.0150.01119.17
7.1.50.0290.01034.96
7.1.00.0000.05022.39
7.0.200.0040.00416.89
7.0.140.0030.07321.97
7.0.100.0070.08019.97
7.0.90.0100.06319.98
7.0.80.0430.07720.19
7.0.70.0370.08019.97
7.0.60.0070.08720.08
7.0.50.0200.06320.37
7.0.40.0070.08720.05
7.0.30.0070.07720.19
7.0.20.0130.08020.10
7.0.10.0030.08720.14
7.0.00.0100.08320.18
5.6.280.0000.07320.78
5.6.250.0100.07720.50
5.6.240.0130.04320.52
5.6.230.0270.06720.75
5.6.220.0200.06320.54
5.6.210.0200.07720.57
5.6.200.0230.06321.00
5.6.190.0100.08321.01
5.6.180.0070.06720.95
5.6.170.0100.08020.95
5.6.160.0070.05021.02
5.6.150.0100.08021.14
5.6.140.0100.08021.05
5.6.130.0100.07021.04
5.6.120.0070.08021.14
5.6.110.0030.06721.03
5.6.100.0070.07020.93
5.6.90.0030.04321.07
5.6.80.0100.07020.47
5.6.70.0070.08020.49
5.6.60.0070.05320.43
5.6.50.0030.08720.41
5.6.40.0100.04320.32
5.6.30.0100.07720.50
5.6.20.0170.07720.38
5.6.10.0130.06320.32
5.6.00.0030.08020.39
5.5.380.0100.08320.52
5.5.370.0170.06320.37
5.5.360.0030.07020.35
5.5.350.0170.07320.37
5.5.340.0030.08320.80
5.5.330.0170.07320.91
5.5.320.0170.06020.87
5.5.310.0100.07720.73
5.5.300.0100.06320.91
5.5.290.0130.07320.92
5.5.280.0030.09020.92
5.5.270.0030.06020.77
5.5.260.0030.04720.87
5.5.250.0100.04720.73
5.5.240.0070.07720.30
5.5.230.0170.07020.30
5.5.220.0100.07320.28
5.5.210.0070.07020.27
5.5.200.0070.08320.17
5.5.190.0070.08020.28
5.5.180.0030.06020.15
5.5.160.0100.04320.09
5.5.150.0030.07320.27
5.5.140.0070.06320.27
5.5.130.0000.07720.21
5.5.120.0000.05020.14
5.5.110.0000.06020.27
5.5.100.0130.07320.11
5.5.90.0070.08020.10
5.5.80.0100.07320.07
5.5.70.0030.08320.16
5.5.60.0000.07020.09
5.5.50.0100.04720.15
5.5.40.0100.07320.05
5.5.30.0070.04020.06
5.5.20.0070.05319.93
5.5.10.0070.08320.08
5.5.00.0100.07019.96
5.4.450.0100.04719.40
5.4.440.0070.10019.27
5.4.430.0000.04719.46
5.4.420.0030.05019.37
5.4.410.0070.03719.32
5.4.400.0070.07019.05
5.4.390.0030.06018.88
5.4.380.0170.06719.18
5.4.370.0070.04319.09
5.4.360.0130.05019.20
5.4.350.0070.07018.88
5.4.340.0100.08018.90
5.4.320.0030.10718.85
5.4.310.0070.08018.88
5.4.300.0100.07019.14
5.4.290.0030.06018.90
5.4.280.0100.03719.14
5.4.270.0130.07019.24
5.4.260.0200.07018.88
5.4.250.0030.08019.06
5.4.240.0070.06019.23
5.4.230.0030.06019.13
5.4.220.0030.06318.89
5.4.210.0030.07019.22
5.4.200.0030.04719.13
5.4.190.0130.07318.99
5.4.180.0070.05319.03
5.4.170.0100.04019.04
5.4.160.0030.07719.03
5.4.150.0130.07018.88
5.4.140.0070.07016.31
5.4.130.0030.07716.19
5.4.120.0100.05016.33
5.4.110.0100.06316.45
5.4.100.0070.07716.54
5.4.90.0100.07316.52
5.4.80.0070.07716.47
5.4.70.0070.07016.34
5.4.60.0100.08016.39
5.4.50.0030.07716.40
5.4.40.0070.04016.41
5.4.30.0070.07316.38
5.4.20.0070.07016.32
5.4.10.0100.07316.48
5.4.00.0100.05715.85
5.3.290.0070.06014.71
5.3.280.0070.08014.54
5.3.270.0130.06714.66
5.3.260.0100.04714.57
5.3.250.0130.06714.51
5.3.240.0030.03714.67
5.3.230.0070.07714.69
5.3.220.0070.07714.52
5.3.210.0070.07714.57
5.3.200.0100.07014.63
5.3.190.0070.05014.56
5.3.180.0030.08014.50
5.3.170.0130.07014.70
5.3.160.0170.05314.54
5.3.150.0230.06014.49
5.3.140.0070.04014.66
5.3.130.0170.04314.56
5.3.120.0130.06714.61
5.3.110.0100.07314.55
5.3.100.0070.07014.16
5.3.90.0030.07314.12
5.3.80.0000.08014.11
5.3.70.0070.07313.99
5.3.60.0070.07014.02
5.3.50.0170.05714.09
5.3.40.0100.07314.00
5.3.30.0100.05713.79
5.3.20.0030.06313.75
5.3.10.0070.06713.77
5.3.00.0030.05713.61
5.2.170.0070.05712.25
5.2.160.0000.03712.25
5.2.150.0000.03312.25
5.2.140.0070.06312.25
5.2.130.0000.03312.25
5.2.120.0100.05012.25
5.2.110.0130.05312.25
5.2.100.0070.03712.25
5.2.90.0000.03312.25
5.2.80.0100.05312.25
5.2.70.0130.06012.25
5.2.60.0070.04712.25
5.2.50.0100.05712.25
5.2.40.0000.06712.25
5.2.30.0100.06012.25
5.2.20.0030.04712.25
5.2.10.0030.05712.25
5.2.00.0070.05712.25
5.1.60.0000.05012.25
5.1.50.0070.05312.25
5.1.40.0000.05012.25
5.1.30.0030.02712.25
5.1.20.0000.05312.25
5.1.10.0000.05012.25
5.1.00.0070.03012.25
5.0.50.0030.02312.25
5.0.40.0100.04012.25
5.0.30.0070.04312.25
5.0.20.0000.03712.25
5.0.10.0030.04712.25
5.0.00.0000.05712.25
4.4.90.0100.03712.25
4.4.80.0000.03712.25
4.4.70.0070.03312.25
4.4.60.0000.02712.25
4.4.50.0000.03712.25
4.4.40.0000.06012.25
4.4.30.0000.03012.25
4.4.20.0070.03312.25
4.4.10.0030.02712.25
4.4.00.0030.04312.25
4.3.110.0000.02012.25
4.3.100.0070.03012.25
4.3.90.0030.02012.25
4.3.80.0000.04712.25
4.3.70.0070.02712.25
4.3.60.0070.03012.25
4.3.50.0070.02012.25
4.3.40.0000.05712.25
4.3.30.0000.02012.25
4.3.20.0030.01712.25
4.3.10.0030.03312.25
4.3.00.0030.02312.25

preferences:
57.78 ms | 401 KiB | 5 Q