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> [^:@/\s]+ ) (?: [:] (?P<pass> [^:@/\s]+ ) )? [@] )? # auth details are optional (?P<host> [^:/?#\s]* ) # 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> [^?#\s]+ )? # path is everything up to the query/fragment (?: [?] (?P<query> [^#\s]+ ) )? # query is optional (?: [#] (?P<fragment> \S+ ) )? # 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.0170.00318.68
8.3.50.0120.00521.27
8.3.40.0110.00419.21
8.3.30.0030.01020.35
8.3.20.0080.00020.67
8.3.10.0050.00321.12
8.3.00.0040.00422.14
8.2.180.0070.00725.92
8.2.170.0150.00019.21
8.2.160.0130.00722.96
8.2.150.0080.00025.66
8.2.140.0050.00324.66
8.2.130.0000.00826.16
8.2.120.0040.00421.15
8.2.110.0090.00019.24
8.2.100.0060.00618.16
8.2.90.0040.00419.23
8.2.80.0000.00818.16
8.2.70.0030.00617.75
8.2.60.0060.00318.05
8.2.50.0080.00018.07
8.2.40.0000.00818.34
8.2.30.0050.00519.56
8.2.20.0080.00017.85
8.2.10.0080.00017.84
8.2.00.0000.00817.95
8.1.280.0040.01125.92
8.1.270.0040.00424.66
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0000.00923.80
8.1.230.0040.00820.88
8.1.220.0000.00818.77
8.1.210.0030.00519.20
8.1.200.0030.00617.50
8.1.190.0050.00317.64
8.1.180.0050.00318.10
8.1.170.0040.00418.84
8.1.160.0080.00018.85
8.1.150.0000.00818.87
8.1.140.0020.00517.54
8.1.130.0040.00417.88
8.1.120.0080.00017.65
8.1.110.0000.00717.53
8.1.100.0040.00417.54
8.1.90.0040.00417.69
8.1.80.0000.00817.70
8.1.70.0030.00317.59
8.1.60.0030.00517.82
8.1.50.0040.00417.62
8.1.40.0040.00417.73
8.1.30.0050.00317.79
8.1.20.0030.00617.85
8.1.10.0030.00617.79
8.1.00.0040.00417.71
8.0.300.0000.00720.06
8.0.290.0080.00017.18
8.0.280.0050.00318.54
8.0.270.0000.00717.27
8.0.260.0000.00717.09
8.0.250.0050.00317.08
8.0.240.0000.00717.15
8.0.230.0000.00717.15
8.0.220.0070.00017.03
8.0.210.0000.00817.01
8.0.200.0040.00417.19
8.0.190.0040.00417.19
8.0.180.0040.00417.19
8.0.170.0040.00417.16
8.0.160.0000.00717.20
8.0.150.0070.00017.09
8.0.140.0040.00417.12
8.0.130.0000.00613.50
8.0.120.0040.00416.98
8.0.110.0040.00417.11
8.0.100.0050.00216.97
8.0.90.0030.00517.13
8.0.80.0060.00917.16
8.0.70.0040.00416.99
8.0.60.0050.00317.01
8.0.50.0050.00217.16
8.0.30.0110.00817.43
8.0.20.0130.00717.40
8.0.10.0070.00017.09
8.0.00.0110.00717.09
7.4.330.0050.00016.88
7.4.320.0040.00416.75
7.4.300.0060.00016.89
7.4.290.0070.00016.77
7.4.280.0000.00716.66
7.4.270.0030.00316.89
7.4.260.0050.00013.54
7.4.250.0000.00816.86
7.4.240.0030.00416.81
7.4.230.0000.00716.88
7.4.220.0130.01316.78
7.4.210.0070.00816.84
7.4.200.0070.00016.94
7.4.190.0040.00417.03
7.4.160.0100.01016.65
7.4.150.0080.00917.40
7.4.140.0090.00917.86
7.4.130.0040.01516.88
7.4.120.0060.01316.75
7.4.110.0140.00316.98
7.4.100.0090.01316.75
7.4.90.0130.01017.07
7.4.80.0120.00619.39
7.4.70.0080.00816.88
7.4.60.0110.01116.86
7.4.50.0000.00816.71
7.4.40.0120.00322.77
7.4.30.0130.00516.89
7.4.00.0070.00915.19
7.3.330.0000.00513.45
7.3.320.0050.00013.59
7.3.310.0000.00716.72
7.3.300.0000.00816.66
7.3.290.0030.01016.63
7.3.280.0050.01216.61
7.3.270.0120.01217.40
7.3.260.0080.00918.24
7.3.250.0130.00516.73
7.3.240.0080.00916.89
7.3.230.0090.00916.80
7.3.210.0180.00016.59
7.3.200.0070.01319.39
7.3.190.0030.01416.63
7.3.180.0100.00616.83
7.3.170.0130.00316.83
7.3.160.0070.01116.57
7.3.120.0080.00815.13
7.3.110.0060.00615.18
7.3.100.0100.00714.77
7.3.90.0070.00715.15
7.3.80.0060.00615.42
7.3.70.0030.00915.09
7.3.60.0030.01215.15
7.3.50.0060.01014.82
7.3.40.0030.00715.29
7.3.30.0100.00315.21
7.3.20.0060.01016.73
7.3.10.0100.00416.84
7.3.00.0100.00117.07
7.2.330.0110.00716.88
7.2.320.0110.00616.95
7.2.310.0090.00917.02
7.2.300.0040.01416.93
7.2.290.0140.00317.04
7.2.250.0030.01415.15
7.2.240.0040.01515.38
7.2.230.0030.01415.52
7.2.220.0040.01115.04
7.2.210.0060.00915.33
7.2.200.0040.01115.26
7.2.190.0060.00315.37
7.2.180.0070.00715.48
7.2.170.0070.00315.28
7.2.130.0040.00917.24
7.2.120.0100.00317.32
7.2.110.0070.00417.20
7.2.100.0040.00717.20
7.2.90.0030.01016.99
7.2.80.0030.00717.17
7.2.70.0040.01117.11
7.2.60.0100.00317.30
7.2.50.0100.00717.27
7.2.40.0000.01017.36
7.2.30.0060.00617.02
7.2.20.0000.01217.22
7.2.10.0030.00917.33
7.2.00.0030.00718.22
7.1.330.0120.00316.05
7.1.320.0070.01016.00
7.1.310.0030.01316.00
7.1.300.0100.00315.96
7.1.290.0040.00415.73
7.1.280.0030.00615.99
7.1.270.0090.01015.88
7.1.260.0060.00916.11
7.1.250.0040.00415.95
7.1.100.0060.00618.71
7.1.70.0040.01117.39
7.1.60.0070.01819.17
7.1.50.0250.01434.69
7.1.00.0030.03322.40
7.0.200.0060.00317.04
7.0.140.0070.06322.23
7.0.100.0200.07020.07
7.0.90.0300.05319.89
7.0.80.0330.09319.98
7.0.70.0470.06719.95
7.0.60.0100.05720.14
7.0.50.0300.06720.39
7.0.40.0070.08720.13
7.0.30.0100.08020.17
7.0.20.0030.06320.10
7.0.10.0030.09020.18
7.0.00.0100.08020.11
5.6.280.0070.07021.11
5.6.250.0030.07720.60
5.6.240.0170.07320.55
5.6.230.0170.03320.50
5.6.220.0070.05320.59
5.6.210.0070.07320.78
5.6.200.0030.08320.96
5.6.190.0100.04020.96
5.6.180.0130.07321.04
5.6.170.0130.04321.18
5.6.160.0130.07721.14
5.6.150.0130.07321.04
5.6.140.0130.08021.11
5.6.130.0000.09021.12
5.6.120.0200.06721.08
5.6.110.0170.07721.10
5.6.100.0070.08321.09
5.6.90.0030.07720.92
5.6.80.0030.05020.36
5.6.70.0100.07020.43
5.6.60.0070.08720.48
5.6.50.0070.06720.33
5.6.40.0000.06720.49
5.6.30.0100.07720.29
5.6.20.0070.07320.40
5.6.10.0100.05720.39
5.6.00.0030.04720.43
5.5.380.0230.06720.45
5.5.370.0070.08320.42
5.5.360.0030.08320.42
5.5.350.0030.03720.47
5.5.340.0030.07020.92
5.5.330.0170.07720.84
5.5.320.0030.08020.78
5.5.310.0100.07720.92
5.5.300.0070.09320.76
5.5.290.0170.04720.64
5.5.280.0030.09020.90
5.5.270.0030.09020.75
5.5.260.0000.05720.76
5.5.250.0100.08020.70
5.5.240.0070.07720.16
5.5.230.0070.07720.26
5.5.220.0170.07020.11
5.5.210.0100.04020.26
5.5.200.0170.03020.20
5.5.190.0000.08320.22
5.5.180.0070.07720.16
5.5.160.0100.08020.29
5.5.150.0100.08720.23
5.5.140.0400.02720.21
5.5.130.0070.08019.99
5.5.120.0070.04020.18
5.5.110.0070.06020.25
5.5.100.0100.08020.18
5.5.90.0030.05020.16
5.5.80.0070.04320.13
5.5.70.0030.04020.15
5.5.60.0000.04020.09
5.5.50.0030.04020.10
5.5.40.0030.04020.12
5.5.30.0030.03320.04
5.5.20.0000.03720.15
5.5.10.0000.04720.06
5.5.00.0070.03720.12
5.4.450.0030.08319.23
5.4.440.0000.08719.53
5.4.430.0070.05719.44
5.4.420.0130.06719.36
5.4.410.0100.07719.23
5.4.400.0030.08019.20
5.4.390.0070.03719.21
5.4.380.0130.07018.95
5.4.370.0070.06719.18
5.4.360.0000.04319.14
5.4.350.0070.04018.86
5.4.340.0170.07018.95
5.4.320.0070.06718.85
5.4.310.0070.04319.13
5.4.300.0070.05719.16
5.4.290.0070.08018.87
5.4.280.0100.05019.13
5.4.270.0030.04719.05
5.4.260.0130.06719.12
5.4.250.0070.04719.22
5.4.240.0030.03319.04
5.4.230.0030.04319.04
5.4.220.0070.03318.89
5.4.210.0000.04018.90
5.4.200.0030.04719.22
5.4.190.0000.03719.15
5.4.180.0070.03018.93
5.4.170.0000.04019.16
5.4.160.0000.04018.92
5.4.150.0000.04019.12
5.4.140.0100.03316.41
5.4.130.0000.03716.45
5.4.120.0000.07016.49
5.4.110.0070.06316.32
5.4.100.0030.03316.39
5.4.90.0070.03316.27
5.4.80.0030.05016.45
5.4.70.0070.03016.42
5.4.60.0030.03716.48
5.4.50.0070.03716.44
5.4.40.0070.03716.50
5.4.30.0100.03016.40
5.4.20.0070.04016.33
5.4.10.0030.04316.46
5.4.00.0000.04015.86
5.3.290.0130.04314.78
5.3.280.0030.03714.60
5.3.270.0070.03314.60
5.3.260.0030.03714.70
5.3.250.0100.03314.56
5.3.240.0030.03714.59
5.3.230.0000.05014.63
5.3.220.0070.05014.50
5.3.210.0070.04014.69
5.3.200.0030.04014.69
5.3.190.0000.05014.59
5.3.180.0070.04314.55
5.3.170.0030.04014.49
5.3.160.0070.03714.52
5.3.150.0030.04014.67
5.3.140.0070.05714.66
5.3.130.0070.03714.60
5.3.120.0030.03714.67
5.3.110.0030.03714.56
5.3.100.0030.05014.01
5.3.90.0070.03314.09
5.3.80.0000.04013.99
5.3.70.0000.04713.92
5.3.60.0030.03714.03
5.3.50.0100.02713.95
5.3.40.0000.04013.92
5.3.30.0030.05013.81
5.3.20.0100.03013.81
5.3.10.0000.03713.71
5.3.00.0030.03313.70
5.2.170.0030.03012.14
5.2.160.0000.03312.14
5.2.150.0030.03012.14
5.2.140.0030.03012.14
5.2.130.0030.03312.14
5.2.120.0000.03012.14
5.2.110.0070.02312.14
5.2.100.0070.03012.14
5.2.90.0000.03012.14
5.2.80.0070.02712.14
5.2.70.0030.02712.14
5.2.60.0000.03312.14
5.2.50.0030.02712.14
5.2.40.0030.03312.14
5.2.30.0070.02712.14
5.2.20.0000.03012.14
5.2.10.0000.02712.14
5.2.00.0030.02712.14
5.1.60.0000.02712.14
5.1.50.0030.02712.14
5.1.40.0030.02312.14
5.1.30.0070.02312.14
5.1.20.0030.05012.14
5.1.10.0030.05012.14
5.1.00.0030.05712.14
5.0.50.0070.02712.14
5.0.40.0000.04712.14
5.0.30.0000.06712.14
5.0.20.0070.04312.14
5.0.10.0100.04012.14
5.0.00.0030.05712.14
4.4.90.0000.02012.14
4.4.80.0000.01712.14
4.4.70.0030.01312.14
4.4.60.0000.01712.14
4.4.50.0000.01312.14
4.4.40.0000.02312.14
4.4.30.0000.01312.14
4.4.20.0000.03712.14
4.4.10.0030.03312.14
4.4.00.0030.04712.14
4.3.110.0100.02712.14
4.3.100.0000.03312.14
4.3.90.0030.03712.14
4.3.80.0000.04712.14
4.3.70.0000.02312.14
4.3.60.0030.03712.14
4.3.50.0030.01712.14
4.3.40.0000.05312.14
4.3.30.0000.03312.14
4.3.20.0000.03712.14
4.3.10.0000.03312.14
4.3.00.0030.03012.14

preferences:
48.62 ms | 401 KiB | 5 Q