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:123456/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.0060.01018.66
8.3.50.0090.01021.39
8.3.40.0110.00418.96
8.3.30.0100.00320.34
8.3.20.0080.00020.86
8.3.10.0040.00421.13
8.3.00.0080.00022.48
8.2.180.0120.00916.63
8.2.170.0100.01022.96
8.2.160.0070.00720.33
8.2.150.0030.00524.18
8.2.140.0090.00024.66
8.2.130.0040.00426.16
8.2.120.0000.00721.13
8.2.110.0030.00619.17
8.2.100.0110.00417.90
8.2.90.0000.00819.17
8.2.80.0080.00017.97
8.2.70.0040.00417.88
8.2.60.0030.00617.93
8.2.50.0030.00618.07
8.2.40.0030.00518.16
8.2.30.0080.00019.38
8.2.20.0000.00717.96
8.2.10.0040.00417.84
8.2.00.0030.00517.93
8.1.280.0080.00825.92
8.1.270.0000.00723.99
8.1.260.0040.00426.35
8.1.250.0030.00528.09
8.1.240.0030.00622.80
8.1.230.0040.00720.90
8.1.220.0040.00417.79
8.1.210.0000.00918.77
8.1.200.0070.00317.36
8.1.190.0000.00817.60
8.1.180.0040.00418.10
8.1.170.0000.00818.91
8.1.160.0040.00418.87
8.1.150.0070.00018.81
8.1.140.0000.00817.55
8.1.130.0030.00317.93
8.1.120.0000.00717.61
8.1.110.0040.00417.65
8.1.100.0000.00817.54
8.1.90.0040.00417.65
8.1.80.0000.00717.54
8.1.70.0070.00017.51
8.1.60.0030.00617.73
8.1.50.0040.00417.73
8.1.40.0000.00917.59
8.1.30.0050.00317.84
8.1.20.0040.00417.80
8.1.10.0040.00417.75
8.1.00.0000.01117.71
8.0.300.0040.00418.77
8.0.290.0000.00717.00
8.0.280.0070.00018.51
8.0.270.0000.00817.25
8.0.260.0000.00817.08
8.0.250.0040.00417.21
8.0.240.0030.00517.24
8.0.230.0040.00417.12
8.0.220.0030.00517.16
8.0.210.0000.00717.12
8.0.200.0030.00317.20
8.0.190.0040.00417.08
8.0.180.0060.00317.20
8.0.170.0040.00417.15
8.0.160.0000.00817.07
8.0.150.0040.00417.05
8.0.140.0030.00517.10
8.0.130.0030.00313.59
8.0.120.0030.00717.09
8.0.110.0000.00817.15
8.0.100.0040.00417.01
8.0.90.0050.00317.12
8.0.80.0130.00317.04
8.0.70.0030.00616.99
8.0.60.0040.00417.18
8.0.50.0040.00417.13
8.0.30.0120.00917.62
8.0.20.0160.00617.40
8.0.10.0040.00417.22
8.0.00.0080.01316.84
7.4.330.0000.00516.81
7.4.320.0030.00316.85
7.4.300.0060.00016.80
7.4.290.0040.00416.83
7.4.280.0030.00516.76
7.4.270.0030.00316.69
7.4.260.0000.00513.52
7.4.250.0040.00416.74
7.4.240.0020.00616.77
7.4.230.0000.00716.86
7.4.220.0090.00916.95
7.4.210.0090.00616.84
7.4.200.0000.00716.86
7.4.190.0050.00317.03
7.4.160.0160.00616.89
7.4.150.0180.00717.40
7.4.140.0140.00817.86
7.4.130.0120.00816.81
7.4.120.0080.01116.75
7.4.110.0100.01017.01
7.4.100.0130.00616.82
7.4.90.0130.01016.82
7.4.80.0120.00819.39
7.4.70.0140.00316.69
7.4.60.0110.00816.70
7.4.50.0080.00016.81
7.4.40.0070.01122.77
7.4.30.0060.01116.91
7.4.00.0030.01415.17
7.3.330.0030.00313.41
7.3.320.0030.00313.46
7.3.310.0000.00716.52
7.3.300.0030.00316.43
7.3.290.0070.00716.64
7.3.280.0100.00616.62
7.3.270.0130.01017.40
7.3.260.0080.00918.24
7.3.250.0120.00916.76
7.3.240.0030.01516.83
7.3.230.0090.00916.83
7.3.210.0100.00616.56
7.3.200.0150.00819.39
7.3.190.0110.01116.75
7.3.180.0070.01416.83
7.3.170.0090.00816.79
7.3.160.0110.01116.81
7.3.120.0000.01414.85
7.2.330.0110.00716.97
7.2.320.0070.01116.95
7.2.310.0110.00717.02
7.2.300.0100.00717.02
7.2.290.0060.01017.06
7.2.00.0040.00819.45
7.1.200.0080.00316.05
7.1.100.0030.00918.39
7.1.70.0000.01117.11
7.1.60.0130.00619.17
7.1.50.0270.01034.97
7.1.00.0070.03022.40
7.0.200.0050.00316.61
7.0.140.0070.07321.95
7.0.70.0670.02719.95
7.0.60.0530.06019.91
7.0.50.0670.06320.39
7.0.40.0000.03720.11
7.0.30.0030.04020.16
7.0.20.0070.04020.04
7.0.10.0030.04020.18
7.0.00.0030.04320.16
5.6.280.0030.07021.10
5.6.220.0000.04320.58
5.6.210.0030.04320.61
5.6.200.0030.04321.09
5.6.190.0000.04321.04
5.6.180.0030.04021.04
5.6.170.0030.04721.07
5.6.160.0000.05721.07
5.6.150.0030.07721.08
5.6.140.0100.04020.96
5.6.130.0030.04720.96
5.6.120.0070.04020.94
5.6.110.0100.03721.17
5.6.100.0030.05321.07
5.6.90.0000.03721.04
5.6.80.0070.03720.43
5.6.70.0030.04020.55
5.6.60.0030.04020.39
5.6.50.0100.07720.34
5.6.40.0070.05020.33
5.6.30.0170.07320.38
5.6.20.0070.07720.31
5.6.10.0100.03720.38
5.6.00.0070.08020.28
5.5.360.0070.04320.37
5.5.350.0000.04020.45
5.5.340.0070.04020.80
5.5.330.0070.04020.92
5.5.320.0070.03720.84
5.5.310.0030.04020.64
5.5.300.0000.04720.64
5.5.290.0030.04020.89
5.5.280.0030.03720.86
5.5.270.0030.03320.88
5.5.260.0030.05320.91
5.5.250.0130.03020.70
5.5.240.0100.08020.27
5.5.230.0070.03720.25
5.5.220.0100.03020.27
5.5.210.0030.04720.03
5.5.200.0030.07720.16
5.5.190.0030.08320.12
5.5.180.0070.07720.26
5.5.160.0070.08320.24
5.5.150.0100.05320.14
5.5.140.0030.09020.13
5.5.130.0070.06720.08
5.5.120.0100.05020.25
5.5.110.0030.07720.17
5.5.100.0100.07720.17
5.5.90.0030.06320.15
5.5.80.0130.07020.18
5.5.70.0070.05020.15
5.5.60.0070.05719.93
5.5.50.0130.07320.09
5.5.40.0100.07320.05
5.5.30.0030.08720.06
5.5.20.0030.08720.15
5.5.10.0130.07720.05
5.5.00.0000.08719.97
5.4.450.0000.04319.36
5.4.440.0070.03719.23
5.4.430.0030.04719.53
5.4.420.0070.06719.51
5.4.410.0070.07019.43
5.4.400.0030.03719.17
5.4.390.0100.05719.03
5.4.380.0000.04019.16
5.4.370.0000.05319.09
5.4.360.0000.07318.95
5.4.350.0100.07718.87
5.4.340.0100.05318.85
5.4.320.0070.07719.21
5.4.310.0100.04719.15
5.4.300.0170.07319.18
5.4.290.0070.07718.89
5.4.280.0100.04719.21
5.4.270.0100.08018.88
5.4.260.0070.05018.94
5.4.250.0170.07019.12
5.4.240.0070.07319.03
5.4.230.0000.04319.02
5.4.220.0130.07319.18
5.4.210.0100.06719.04
5.4.200.0070.06018.94
5.4.190.0100.04719.08
5.4.180.0070.05018.93
5.4.170.0100.08019.08
5.4.160.0030.08319.10
5.4.150.0100.08019.04
5.4.140.0000.08016.30
5.4.130.0130.06716.39
5.4.120.0130.06716.55
5.4.110.0070.07716.48
5.4.100.0100.07016.44
5.4.90.0070.05016.54
5.4.80.0070.05016.43
5.4.70.0000.08016.47
5.4.60.0030.05316.51
5.4.50.0070.07316.38
5.4.40.0070.07716.45
5.4.30.0070.07016.35
5.4.20.0070.05716.32
5.4.10.0100.07316.49
5.4.00.0100.07315.87
5.3.290.0000.08014.59
5.3.280.0130.07314.61
5.3.270.0100.06314.61
5.3.260.0130.06714.75
5.3.250.0100.07314.73
5.3.240.0030.07314.67
5.3.230.0070.07714.70
5.3.220.0070.05714.50
5.3.210.0100.06714.60
5.3.200.0100.03314.56
5.3.190.0070.08014.57
5.3.180.0130.06714.64
5.3.170.0070.05014.70
5.3.160.0030.08014.68
5.3.150.0030.07714.67
5.3.140.0100.07314.62
5.3.130.0070.05714.48
5.3.120.0030.07314.52
5.3.110.0070.07314.53
5.3.100.0030.06314.06
5.3.90.0030.07714.00
5.3.80.0100.06014.10
5.3.70.0030.07314.13
5.3.60.0070.07713.92
5.3.50.0100.07013.95
5.3.40.0030.07713.85
5.3.30.0030.07714.02
5.3.20.0030.07013.64
5.3.10.0070.06713.59
5.3.00.0030.05313.77
5.2.170.0030.06712.25
5.2.160.0070.06312.25
5.2.150.0000.05312.25
5.2.140.0070.06312.25
5.2.130.0170.04712.25
5.2.120.0070.06012.25
5.2.110.0100.06012.25
5.2.100.0100.05712.25
5.2.90.0100.06012.25
5.2.80.0000.06312.25
5.2.70.0100.05312.25
5.2.60.0030.06012.25
5.2.50.0000.07012.25
5.2.40.0000.06312.25
5.2.30.0070.06012.25
5.2.20.0030.06712.25
5.2.10.0000.06012.25
5.2.00.0100.05312.25
5.1.60.0070.04712.25
5.1.50.0070.04712.25
5.1.40.0030.06012.25
5.1.30.0070.05712.25
5.1.20.0100.05012.25
5.1.10.0030.03712.25
5.1.00.0000.04312.25
5.0.50.0070.03312.25
5.0.40.0000.04012.25
5.0.30.0000.06312.25
5.0.20.0000.03312.25
5.0.10.0000.04712.25
5.0.00.0030.06312.25
4.4.90.0030.03712.25
4.4.80.0030.03312.25
4.4.70.0000.03012.25
4.4.60.0030.03312.25
4.4.50.0000.03712.25
4.4.40.0000.05712.25
4.4.30.0000.02012.25
4.4.20.0000.03012.25
4.4.10.0000.02312.25
4.4.00.0000.05012.25
4.3.110.0100.02712.25
4.3.100.0000.03712.25
4.3.90.0070.03012.25
4.3.80.0000.05012.25
4.3.70.0000.03712.25
4.3.60.0030.03312.25
4.3.50.0000.03712.25
4.3.40.0030.05312.25
4.3.30.0030.03012.25
4.3.20.0030.02712.25
4.3.10.0000.01712.25
4.3.00.0030.03712.25

preferences:
45.35 ms | 401 KiB | 5 Q