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 = 'http:/test'; var_dump(parse_url($url));

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.40.0120.00419.18
8.3.30.0150.00019.03
8.3.20.0080.00020.31
8.3.10.0030.00522.13
8.3.00.0050.00320.91
8.2.170.0070.00722.96
8.2.160.0060.00919.12
8.2.150.0090.00624.18
8.2.140.0000.00824.66
8.2.130.0050.00526.16
8.2.120.0040.00419.63
8.2.110.0090.00019.24
8.2.100.0080.00418.16
8.2.90.0060.00319.30
8.2.80.0000.00817.97
8.2.70.0030.00617.88
8.2.60.0040.00418.05
8.2.50.0040.00418.07
8.2.40.0040.00418.16
8.2.30.0040.00418.20
8.2.20.0040.00417.85
8.2.10.0040.00417.94
8.2.00.0040.00417.92
8.1.270.0060.00322.30
8.1.260.0040.01126.35
8.1.250.0050.00328.09
8.1.240.0030.00721.52
8.1.230.0110.00017.61
8.1.220.0030.00517.88
8.1.210.0050.00318.77
8.1.200.0050.00517.61
8.1.190.0000.00817.60
8.1.180.0080.00018.70
8.1.170.0000.00818.95
8.1.160.0000.00722.08
8.1.150.0000.00918.71
8.1.140.0060.00317.56
8.1.130.0030.00317.82
8.1.120.0030.00517.57
8.1.110.0060.00617.60
8.1.100.0040.00417.70
8.1.90.0040.00417.69
8.1.80.0030.00517.62
8.1.70.0000.00717.55
8.1.60.0000.00817.73
8.1.50.0030.00517.75
8.1.40.0000.00817.66
8.1.30.0030.00617.74
8.1.20.0000.00817.86
8.1.10.0050.00317.77
8.1.00.0000.00917.60
8.0.300.0020.00518.77
8.0.290.0060.00317.00
8.0.280.0000.00818.45
8.0.270.0050.00317.28
8.0.260.0030.00317.01
8.0.250.0080.00017.11
8.0.240.0070.00017.22
8.0.230.0030.00417.18
8.0.220.0000.00717.21
8.0.210.0040.00417.04
8.0.200.0070.00017.20
8.0.190.0040.00417.23
8.0.180.0040.00417.16
8.0.170.0030.00517.02
8.0.160.0000.00817.16
8.0.150.0040.00416.97
8.0.140.0000.00716.97
8.0.130.0000.00613.54
8.0.120.0050.00317.02
8.0.110.0050.00217.15
8.0.100.0040.00417.03
8.0.90.0000.00717.07
8.0.80.0160.00617.13
8.0.70.0080.00017.23
8.0.60.0080.00016.94
8.0.50.0030.00617.03
8.0.30.0060.01617.44
8.0.20.0090.01317.43
8.0.10.0000.00717.08
8.0.00.0090.00917.06
7.4.330.0050.00015.20
7.4.320.0030.00316.75
7.4.300.0000.00816.90
7.4.290.0040.00416.74
7.4.280.0000.00716.85
7.4.270.0070.00016.84
7.4.260.0050.00216.87
7.4.250.0030.00616.74
7.4.240.0040.00316.78
7.4.230.0000.00716.66
7.4.220.0090.00916.84
7.4.210.0090.00616.84
7.4.200.0040.00416.94
7.4.190.0040.00416.82
7.4.160.0040.01316.88
7.4.150.0040.01317.40
7.4.140.0140.00717.86
7.4.130.0160.00316.73
7.4.120.0100.00816.79
7.4.110.0100.00716.84
7.4.100.0140.01116.77
7.4.90.0090.00916.54
7.4.80.0130.00619.39
7.4.70.0030.01416.64
7.4.60.0090.00916.82
7.4.50.0040.00416.59
7.4.40.0100.00722.77
7.4.30.0140.00616.84
7.4.00.0060.00915.31
7.3.330.0030.00313.47
7.3.320.0050.00013.44
7.3.310.0070.00016.62
7.3.300.0070.00016.63
7.3.290.0140.00516.52
7.3.280.0070.01216.61
7.3.270.0100.00717.40
7.3.260.0070.01016.68
7.3.250.0090.00916.71
7.3.240.0090.00916.77
7.3.230.0130.00416.71
7.3.210.0170.00016.58
7.3.200.0090.00619.39
7.3.190.0030.01516.58
7.3.180.0130.00716.71
7.3.170.0100.00616.69
7.3.160.0080.00816.76
7.3.120.0100.00715.07
7.2.330.0060.01216.89
7.2.320.0090.00916.86
7.2.310.0080.01616.93
7.2.300.0150.00317.00
7.2.290.0070.01016.84
7.2.00.0060.00619.97
7.1.100.0300.01118.34
7.1.70.0730.00615.54
7.1.60.0510.01215.77
7.1.50.0540.01015.14
7.1.40.0490.00715.01
7.1.30.0750.01015.16
7.1.20.0750.01215.08
7.1.10.0520.00715.01
7.1.00.0540.00615.20
7.0.200.0590.00315.01
7.0.190.0510.00715.32
7.0.180.5240.00715.01
7.0.170.0970.00715.01
7.0.160.0860.00315.01
7.0.150.0480.00715.01
7.0.140.0730.00715.01
7.0.130.0560.00315.01
7.0.120.0510.00415.21
7.0.110.0520.00415.20
7.0.100.0450.00615.01
7.0.90.0530.00615.01
7.0.80.0520.00415.01
7.0.70.3780.00315.01
7.0.60.0760.01315.01
7.0.50.0450.00715.01
7.0.40.0090.00315.01
7.0.30.0040.00715.01
7.0.20.0060.00615.01
7.0.10.0070.00715.01
7.0.00.0120.00215.01
5.6.300.0170.03720.83
5.6.290.0130.04620.73
5.6.280.0100.04320.84
5.6.270.0040.06620.84
5.6.260.0000.05120.90
5.6.250.0130.03620.91
5.6.240.0130.04120.89
5.6.230.0070.06720.95
5.6.220.0130.07920.91
5.6.210.0040.05220.64
5.6.200.0140.04620.95
5.6.190.0000.05221.06
5.6.180.0130.03521.05
5.6.170.0070.04620.76
5.6.160.0030.05921.07
5.6.150.0130.03721.07
5.6.140.0030.04520.91
5.6.130.0030.05420.99
5.6.120.0100.04020.75
5.6.110.0100.04320.93
5.6.100.0100.08121.05
5.6.90.0110.04220.93
5.6.80.0280.02520.36
5.6.70.0180.03620.21
5.6.60.0110.03620.36
5.6.50.0070.04020.19
5.6.40.0140.03420.31
5.6.30.0110.03620.18
5.6.20.0060.04420.19
5.6.10.0070.04120.11
5.6.00.0100.04320.11
5.5.380.0070.04517.46
5.5.370.0100.03917.64
5.5.360.0100.04017.60
5.5.350.0100.03817.54
5.5.340.0030.06618.06
5.5.330.0100.03817.70
5.5.320.0140.06618.06
5.5.310.0060.04918.09
5.5.300.0000.04618.05
5.5.290.0100.05117.94
5.5.280.0030.05217.84
5.5.270.0030.04917.97
5.5.260.0100.03618.06
5.5.250.0140.03117.86
5.5.240.0060.04417.33
5.5.230.0060.03817.32
5.5.220.0030.04017.31
5.5.210.0070.03617.48
5.5.200.0070.03717.20
5.5.190.0100.04017.41
5.5.180.0060.04117.42
5.5.160.0150.03017.20
5.5.150.0110.06017.21
5.5.140.0100.03917.43
5.5.130.0090.04317.43
5.5.120.0100.03717.15
5.5.110.0030.04417.34
5.5.100.0000.04317.33
5.5.90.0160.05417.33
5.5.80.0070.03917.32
5.5.70.0140.03017.32
5.5.60.0030.05217.30
5.5.50.0100.03217.06
5.5.40.0120.03117.30
5.5.30.0100.06617.23
5.5.20.0200.04616.94
5.5.10.0070.03816.98
5.5.00.0090.03817.28
5.4.450.0140.03619.27
5.4.440.0000.04619.21
5.4.430.0070.04919.51
5.4.420.0030.04519.25
5.4.410.0100.03519.33
5.4.400.0030.04118.98
5.4.390.0000.04419.19
5.4.380.0060.03719.19
5.4.370.0190.02518.93
5.4.360.0000.04318.94
5.4.350.0030.04318.93
5.4.340.0040.04619.21
5.4.320.0000.07719.05
5.4.310.0130.05418.96
5.4.300.0070.06119.22
5.4.290.0100.04119.14
5.4.280.0000.05018.92
5.4.270.0070.04218.92
5.4.260.0100.03419.21
5.4.250.0070.07719.11
5.4.240.0060.03919.18
5.4.230.0150.03418.98
5.4.220.0030.04119.00
5.4.210.0060.05518.93
5.4.200.0130.05019.18
5.4.190.0100.04318.88
5.4.180.0070.07319.00
5.4.170.0120.03619.21
5.4.160.0090.03618.92
5.4.150.0120.03318.87
5.4.140.0090.05016.47
5.4.130.0030.06916.48
5.4.120.0070.04716.76
5.4.110.0040.04216.73
5.4.100.0100.06816.51
5.4.90.0030.03816.74
5.4.80.0070.07016.77
5.4.70.0060.07116.66
5.4.60.0090.03316.51
5.4.50.0030.03816.75
5.4.40.0130.05516.70
5.4.30.0070.03916.64
5.4.20.0130.02916.71
5.4.10.0000.04316.36
5.4.00.0170.02516.13
5.3.290.0070.06515.01
5.3.280.0100.03415.01
5.3.270.0100.03915.01
5.3.260.0030.04115.01
5.3.250.0030.08215.01
5.3.240.0040.05015.01
5.3.230.0060.04115.01
5.3.220.0060.03515.01
5.3.210.0070.03715.01
5.3.200.0070.07315.01
5.3.190.0030.08115.01
5.3.180.0130.06615.01
5.3.170.0030.07015.01
5.3.160.0100.03815.01
5.3.150.0100.04415.01
5.3.140.0090.03815.01
5.3.130.0070.03715.01
5.3.120.0030.04015.01
5.3.110.0000.04815.01
5.3.100.0060.03715.01
5.3.90.0040.04915.01
5.3.80.0000.08715.01
5.3.70.0060.03815.01
5.3.60.0070.06915.01
5.3.50.0060.03515.01
5.3.40.0070.03615.01
5.3.30.0040.04215.01
5.3.20.0160.02915.01
5.3.10.0100.03215.01
5.3.00.0130.03315.01

preferences:
29.84 ms | 400 KiB | 5 Q