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_ALL = 0x0FF; const PHP_URL_REQUIRE_SCHEME = 0x100; const PHP_URL_DISALLOW_EMPTY_AUTHORITY = 0x200; function parse_url($url, $flags = PHP_URL_ALL) { 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 = <<<EXPR ! ^ (?: (?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 EXPR; if (!preg_match($pattern, trim($url), $matches)) { return 1; } if ($flags & PHP_URL_REQUIRE_SCHEME) { if (!isset($matches['scheme']) || $matches['scheme'] === '') { return 2; } } if ($flags & PHP_URL_DISALLOW_EMPTY_AUTHORITY) { if (isset($matches['hasauthority']) && $matches['hasauthority'] && (!isset($matches['host']) || $matches['host'] === '')) { return 3; } } // Default to all components, allowing the above flags // to be specified without specifying the components $flags = $flags & PHP_URL_ALL ?: PHP_URL_ALL; $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 = '//foo:123454#fooo'; var_dump(parse_url($url, PHP_URL_REQUIRE_SCHEME));

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.0150.00221.21
8.3.40.0100.01019.13
8.3.30.0060.01220.09
8.3.20.0030.00520.61
8.3.10.0080.00021.11
8.3.00.0060.00322.34
8.2.180.0190.00316.88
8.2.170.0140.00722.96
8.2.160.0120.00320.35
8.2.150.0050.00324.18
8.2.140.0080.00024.66
8.2.130.0000.00826.16
8.2.120.0050.00321.31
8.2.110.0000.01019.21
8.2.100.0110.00018.03
8.2.90.0050.00319.39
8.2.80.0060.00318.00
8.2.70.0090.00017.88
8.2.60.0080.00018.04
8.2.50.0040.00418.07
8.2.40.0040.00418.28
8.2.30.0030.00519.41
8.2.20.0000.00817.96
8.2.10.0050.00317.98
8.2.00.0000.00817.98
8.1.280.0080.00825.92
8.1.270.0040.00423.99
8.1.260.0080.00026.35
8.1.250.0040.00428.09
8.1.240.0090.00023.83
8.1.230.0000.01221.08
8.1.220.0000.00818.77
8.1.210.0060.00319.22
8.1.200.0030.00617.38
8.1.190.0000.00817.64
8.1.180.0040.00418.10
8.1.170.0030.00518.84
8.1.160.0000.00718.96
8.1.150.0040.00418.75
8.1.140.0000.00817.52
8.1.130.0040.00417.77
8.1.120.0030.00517.56
8.1.110.0040.00417.55
8.1.100.0050.00317.60
8.1.90.0000.00717.67
8.1.80.0040.00417.71
8.1.70.0030.00317.59
8.1.60.0000.00817.62
8.1.50.0000.00917.64
8.1.40.0000.00817.71
8.1.30.0030.00517.70
8.1.20.0050.00217.82
8.1.10.0040.00417.69
8.1.00.0030.00517.68
8.0.300.0050.00220.10
8.0.290.0040.00417.16
8.0.280.0000.00818.51
8.0.270.0030.00317.32
8.0.260.0030.00316.99
8.0.250.0000.00817.25
8.0.240.0030.00617.19
8.0.230.0050.00217.23
8.0.220.0000.00717.08
8.0.210.0000.00717.11
8.0.200.0030.00317.19
8.0.190.0080.00017.14
8.0.180.0050.00217.15
8.0.170.0030.00517.21
8.0.160.0050.00317.02
8.0.150.0000.00717.04
8.0.140.0020.00517.13
8.0.130.0030.00313.57
8.0.120.0000.00817.16
8.0.110.0050.00317.11
8.0.100.0030.00517.21
8.0.90.0040.00417.06
8.0.80.0030.01217.13
8.0.70.0070.00017.21
8.0.60.0040.00417.02
8.0.50.0050.00317.09
8.0.30.0160.00417.40
8.0.20.0140.00917.50
8.0.10.0050.00317.31
8.0.00.0030.01416.95
7.4.330.0030.00316.80
7.4.320.0000.00716.90
7.4.300.0000.00716.82
7.4.290.0000.00716.76
7.4.280.0030.00516.65
7.4.270.0030.00316.79
7.4.260.0030.00313.53
7.4.250.0050.00316.78
7.4.240.0020.00616.81
7.4.230.0040.00416.61
7.4.220.0130.01316.90
7.4.210.0080.00716.87
7.4.200.0070.00016.89
7.4.190.0040.00416.86
7.4.160.0110.00616.74
7.4.150.0150.00917.40
7.4.140.0080.01217.86
7.4.130.0080.00916.87
7.4.120.0120.00716.75
7.4.110.0120.00616.64
7.4.100.0160.00916.93
7.4.90.0060.01316.80
7.4.80.0060.01319.39
7.4.70.0060.01216.81
7.4.60.0060.01516.90
7.4.50.0080.00016.54
7.4.40.0090.00922.77
7.4.30.0160.00816.81
7.4.10.0000.01815.21
7.4.00.0090.00814.96
7.3.330.0000.00613.68
7.3.320.0000.00613.60
7.3.310.0040.00416.49
7.3.300.0070.00016.64
7.3.290.0040.01516.49
7.3.280.0050.01016.51
7.3.270.0210.00617.40
7.3.260.0120.00718.24
7.3.250.0120.00716.78
7.3.240.0080.00816.61
7.3.230.0100.00716.60
7.3.210.0070.01016.63
7.3.200.0180.01019.39
7.3.190.0090.00916.75
7.3.180.0040.01116.84
7.3.170.0110.00616.69
7.3.160.0110.00816.62
7.3.130.0060.01315.27
7.3.120.0030.01215.00
7.3.110.0070.01114.77
7.3.100.0070.00915.16
7.3.90.0000.01214.93
7.3.80.0110.00315.23
7.3.70.0060.00814.89
7.3.60.0110.00414.96
7.3.50.0080.00515.03
7.3.40.0030.01014.78
7.3.30.0070.00715.02
7.3.20.0050.01017.00
7.3.10.0080.00616.81
7.3.00.0050.00516.77
7.2.330.0090.00917.03
7.2.320.0160.00717.02
7.2.310.0060.01517.06
7.2.300.0040.01516.94
7.2.290.0130.00316.92
7.2.260.0030.01615.39
7.2.250.0070.01115.13
7.2.240.0050.01215.34
7.2.230.0070.00615.33
7.2.220.0080.01015.34
7.2.210.0080.01115.25
7.2.200.0070.00815.36
7.2.190.0080.00815.22
7.2.180.0050.00515.38
7.2.170.0020.01115.23
7.2.160.0030.01315.38
7.2.150.0030.01017.13
7.2.140.0000.01517.00
7.2.130.0110.00017.09
7.2.120.0040.00717.13
7.2.110.0070.00717.15
7.2.100.0070.00717.16
7.2.90.0060.00916.89
7.2.80.0060.01317.11
7.2.70.0060.00917.14
7.2.60.0060.00317.11
7.2.50.0100.00316.98
7.2.40.0100.01017.05
7.2.30.0090.00617.27
7.2.20.0080.01217.16
7.2.10.0100.00716.97
7.2.00.0080.00618.28
7.1.330.0070.00715.92
7.1.320.0060.00616.17
7.1.310.0100.00316.02
7.1.300.0060.00816.06
7.1.290.0030.00816.05
7.1.280.0050.00515.96
7.1.270.0030.00716.04
7.1.260.0050.00915.94
7.1.250.0030.00616.06
7.1.240.0000.01415.95
7.1.230.0070.00716.18
7.1.220.0060.00616.04
7.1.210.0040.01115.75
7.1.200.0060.00615.66
7.1.190.0000.01316.04
7.1.180.0040.01115.88
7.1.170.0040.01115.98
7.1.160.0070.00716.00
7.1.150.0040.01115.98
7.1.140.0040.01116.01
7.1.130.0090.00615.93
7.1.120.0000.01215.85
7.1.110.0060.00915.83
7.1.100.0070.00717.26
7.1.90.0080.00815.89
7.1.80.0070.01015.82
7.1.70.0020.01116.71
7.1.60.0080.01117.54
7.1.50.0170.00825.48
7.1.40.0070.01116.18
7.1.30.0070.01115.90
7.1.20.0030.00916.06
7.1.10.0030.00916.18
7.1.00.0020.02119.13
7.0.330.0070.00415.64
7.0.320.0090.00315.72
7.0.310.0060.00615.52
7.0.300.0030.01415.41
7.0.290.0090.00615.79
7.0.280.0030.01015.70
7.0.270.0030.01015.66
7.0.260.0100.00315.43
7.0.250.0070.00715.64
7.0.240.0080.00415.74
7.0.230.0030.01415.75
7.0.220.0120.00315.83
7.0.210.0000.01115.55
7.0.200.0060.00316.29
7.0.190.0070.00715.61
7.0.180.0000.01415.37
7.0.170.0090.00615.71
7.0.160.0060.00315.82
7.0.150.0000.01215.60
7.0.140.0070.03718.67
7.0.130.0060.00915.62
7.0.120.0060.00615.56
7.0.110.0060.00615.67
7.0.100.0050.04717.78
7.0.90.0030.04117.87
7.0.80.0190.03518.01
7.0.70.0080.03117.73
7.0.60.0110.04617.87
7.0.50.0110.03518.07
7.0.40.0030.04916.73
7.0.30.0020.03816.93
7.0.20.0080.04316.93
7.0.10.0100.02816.80
7.0.00.0100.03016.82
5.6.400.0070.01014.86
5.6.390.0040.00414.89
5.6.380.0070.00714.75
5.6.370.0060.00614.60
5.6.360.0060.00914.38
5.6.350.0090.00314.77
5.6.340.0100.00314.71
5.6.330.0060.01014.55
5.6.320.0000.01414.32
5.6.310.0060.00614.31
5.6.300.0100.00014.66
5.6.290.0060.00914.41
5.6.280.0070.03717.87
5.6.270.0100.00714.57
5.6.260.0070.01014.59
5.6.250.0030.03817.52
5.6.240.0030.03817.48
5.6.230.0020.04117.61
5.6.220.0110.04017.59
5.6.210.0120.04217.47
5.6.200.0020.04417.82
5.6.190.0020.03117.73
5.6.180.0050.05017.69
5.6.170.0050.04117.88
5.6.160.0030.04317.83
5.6.150.0050.02817.71
5.6.140.0080.02817.72
5.6.130.0040.04017.64
5.6.120.0060.03017.78
5.6.110.0050.04217.66
5.6.100.0050.04817.74
5.6.90.0120.03717.86
5.6.80.0100.03717.55
5.6.70.0080.02617.49
5.6.60.0050.03017.45
5.6.50.0060.03517.43
5.6.40.0050.04617.46
5.6.30.0120.03717.41
5.6.20.0100.04017.41
5.6.10.0100.02517.31
5.6.00.0060.04017.35
5.5.380.0080.03317.45
5.5.370.0070.04117.54
5.5.360.0130.04017.33
5.5.350.0070.03917.49
5.5.340.0120.02717.81
5.5.330.0090.04217.72
5.5.320.0090.03017.62
5.5.310.0050.03017.66
5.5.300.0090.04517.59
5.5.290.0080.03617.38
5.5.280.0070.02917.62
5.5.270.0080.04317.74
5.5.260.0110.04217.64
5.5.250.0120.03717.57
5.5.240.0110.03817.40
5.5.230.0060.04317.35
5.5.220.0070.03017.37
5.5.210.0120.02217.18
5.5.200.0050.04617.39
5.5.190.0140.03617.30
5.5.180.0080.02017.38
5.5.170.0040.01114.18
5.5.160.0080.04417.28
5.5.150.0030.02917.44
5.5.140.0070.02617.29
5.5.130.0070.02717.41
5.5.120.0050.04417.25
5.5.110.0080.04317.12
5.5.100.0030.03717.24
5.5.90.0030.04317.25
5.5.80.0110.03817.16
5.5.70.0050.04517.15
5.5.60.0050.03617.28
5.5.50.0050.04717.08
5.5.40.0080.04117.37
5.5.30.0070.04417.13
5.5.20.0070.03717.31
5.5.10.0050.03717.16
5.5.00.0080.04517.25
5.4.450.0080.02515.48
5.4.440.0060.04915.43
5.4.430.0070.04015.19
5.4.420.0110.03715.37
5.4.410.0090.03815.28
5.4.400.0090.03614.94
5.4.390.0020.04515.07
5.4.380.0030.04215.22
5.4.370.0070.03915.23
5.4.360.0030.04214.99
5.4.350.0080.03515.03
5.4.340.0030.04515.10
5.4.330.0070.00410.96
5.4.320.0100.02215.24
5.4.310.0070.03715.07
5.4.300.0070.03715.23
5.4.290.0110.03515.16
5.4.280.0080.04015.04
5.4.270.0130.03615.26
5.4.260.0070.03714.99
5.4.250.0070.03715.02
5.4.240.0100.04315.29
5.4.230.0080.03815.18
5.4.220.0020.04315.19
5.4.210.0070.04215.19
5.4.200.0060.03615.20
5.4.190.0030.02515.10
5.4.180.0070.04015.15
5.4.170.0100.01915.00
5.4.160.0030.04615.20
5.4.150.0050.05215.01
5.4.140.0050.04013.79
5.4.130.0080.02013.76
5.4.120.0050.03813.89
5.4.110.0080.03813.94
5.4.100.0020.04013.95
5.4.90.0030.03913.92
5.4.80.0030.04013.80
5.4.70.0050.03313.91
5.4.60.0050.02413.74
5.4.50.0030.04113.76
5.4.40.0100.03313.87
5.4.30.0030.02513.87
5.4.20.0030.03513.72
5.4.10.0050.02213.85
5.4.00.0000.03313.55
5.3.290.0050.02512.50
5.3.280.0070.03312.42
5.3.270.0060.03312.41
5.3.260.0030.04412.51
5.3.250.0080.02812.49
5.3.240.0080.04012.48
5.3.230.0020.02812.50
5.3.220.0080.03412.46
5.3.210.0030.03712.46
5.3.200.0050.04112.49
5.3.190.0070.03512.47
5.3.180.0100.03312.39
5.3.170.0040.03812.53
5.3.160.0050.04012.47
5.3.150.0070.03812.54
5.3.140.0080.04012.49
5.3.130.0080.03512.49
5.3.120.0050.04112.43
5.3.110.0030.03512.42
5.3.100.0070.04012.17
5.3.90.0070.03912.22
5.3.80.0050.03912.21
5.3.70.0080.02012.15
5.3.60.0030.02412.12
5.3.50.0050.02312.10
5.3.40.0020.02512.08
5.3.30.0050.02012.13
5.3.20.0050.02911.96
5.3.10.0100.03211.97
5.3.00.0000.02311.92
5.2.170.0030.06311.19
5.2.160.0030.03011.21
5.2.150.0030.04311.21
5.2.140.0070.03711.00
5.2.130.0070.05711.17
5.2.120.0070.03011.07
5.2.110.0070.05710.96
5.2.100.0000.03710.92
5.2.90.0070.05711.05
5.2.80.0070.06311.16
5.2.70.0100.03011.14
5.2.60.0030.03711.09
5.2.50.0030.06310.94
5.2.40.0130.05011.02
5.2.30.0030.03310.92
5.2.20.0070.04011.03
5.2.10.0100.05710.77
5.2.00.0030.06010.66
5.1.60.0030.05310.01
5.1.50.0030.03310.00
5.1.40.0030.0439.96
5.1.30.0070.05310.28
5.1.20.0000.05310.39
5.1.10.0070.0409.95
5.1.00.0100.04710.07
5.0.50.0030.0238.60
5.0.40.0100.0408.29
5.0.30.0000.0378.25
5.0.20.0070.0308.27
5.0.10.0030.0408.27
5.0.00.0000.0638.25
4.4.90.0000.0378.25
4.4.80.0000.0378.25
4.4.70.0030.0378.25
4.4.60.0030.0178.25
4.4.50.0000.0308.25
4.4.40.0000.0478.25
4.4.30.0070.0338.25
4.4.20.0030.0378.25
4.4.10.0030.0278.25
4.4.00.0070.0438.25
4.3.110.0030.0338.25
4.3.100.0030.0338.25
4.3.90.0000.0378.25
4.3.80.0030.0538.25
4.3.70.0070.0178.25
4.3.60.0030.0338.25
4.3.50.0030.0278.25
4.3.40.0000.0578.25
4.3.30.0000.0378.25
4.3.20.0000.0378.25
4.3.10.0000.0178.25
4.3.00.0030.0378.25

preferences:
45.92 ms | 404 KiB | 6 Q