3v4l.org

run code in 300+ PHP versions simultaneously
<?php function parseQueryString($str) { $result = []; foreach (explode('&', $str) as $element) { $parts = explode('=', $element, 2); $key = urldecode(array_shift($parts)); $value = $parts ? urldecode(array_shift($parts)) : ''; if (false !== $pos = strpos($key, '[')) { $base = substr($result, $key, 0, $pos++); $result[$base] = []; $target = &$result[$base]; do { $end = strpos($key, ']', $pos); $index = substr($key, $pos, $end - $pos); $target[$index] = []; $target = &$target[$index]; $pos = $end; } while($pos < strlen($key)); var_dump($result); } } } $str = 'foo=bar&baz[foo]=qux&baz[foo][goat]=chick'; parseQueryString($str);

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.01418.43
8.3.50.0120.00321.02
8.3.40.0030.01418.76
8.3.30.0070.00720.33
8.3.20.0100.00020.16
8.3.10.0050.00322.04
8.3.00.0040.00422.39
8.2.180.0120.00418.48
8.2.170.0110.00422.96
8.2.160.0110.00720.38
8.2.150.0030.00524.18
8.2.140.0150.00624.66
8.2.130.0040.00426.16
8.2.120.0000.00819.66
8.2.110.0030.00621.85
8.2.100.0060.00619.34
8.2.90.0060.00319.07
8.2.80.0040.00419.33
8.2.70.0000.00817.63
8.2.60.0000.00817.80
8.2.50.0040.00418.07
8.2.40.0080.00018.09
8.2.30.0040.00418.00
8.2.20.0000.00817.62
8.2.10.0000.00817.78
8.2.00.0000.00817.81
8.1.280.0120.00325.92
8.1.270.0050.00324.66
8.1.260.0040.00426.35
8.1.250.0000.00728.09
8.1.240.0060.00323.80
8.1.230.0040.00818.92
8.1.220.0050.00317.74
8.1.210.0030.00818.77
8.1.200.0050.00817.38
8.1.190.0040.00417.52
8.1.180.0050.00220.24
8.1.170.0000.00818.71
8.1.160.0000.00722.29
8.1.150.0040.00418.67
8.1.140.0040.00417.39
8.1.130.0000.00717.85
8.1.120.0050.00217.54
8.1.110.0000.00717.48
8.1.100.0040.00417.54
8.1.90.0000.00717.35
8.1.80.0000.00717.39
8.1.70.0030.00317.46
8.1.60.0030.00617.58
8.1.50.0040.00417.59
8.1.40.0060.00317.50
8.1.30.0000.00917.67
8.1.20.0040.00417.59
8.1.10.0000.00717.62
8.1.00.0080.00017.49
8.0.300.0070.00018.77
8.0.290.0050.00217.18
8.0.280.0070.00018.52
8.0.270.0000.00717.36
8.0.260.0000.00716.92
8.0.250.0040.00416.93
8.0.240.0000.00817.01
8.0.230.0050.00217.00
8.0.220.0030.00316.98
8.0.210.0030.00317.00
8.0.200.0040.00417.09
8.0.190.0040.00417.01
8.0.180.0040.00417.09
8.0.170.0100.00016.87
8.0.160.0040.00416.91
8.0.150.0040.00416.95
8.0.140.0000.00716.82
8.0.130.0040.00413.43
8.0.120.0040.00416.91
8.0.110.0040.00416.95
8.0.100.0040.00416.85
8.0.90.0030.00316.92
8.0.80.0060.01016.93
8.0.70.0000.00716.88
8.0.60.0030.00516.84
8.0.50.0050.00316.96
8.0.30.0140.00817.19
8.0.20.0130.00617.46
8.0.10.0000.00716.97
8.0.00.0100.00816.66
7.4.330.0170.03476.95
7.4.320.0230.03080.07
7.4.300.0170.03779.95
7.4.290.0310.02480.04
7.4.280.0220.03279.86
7.4.270.0260.02979.96
7.4.260.0240.03179.86
7.4.250.0360.02080.07
7.4.240.0170.03680.05
7.4.230.0210.03179.95
7.4.220.0430.08380.04
7.4.210.0630.06279.99
7.4.200.0310.02179.90
7.4.190.0200.03379.88
7.4.160.0490.06980.04
7.4.150.0790.06280.27
7.4.140.0720.07880.04
7.4.130.0730.07979.98
7.4.120.0770.05480.02
7.4.110.0670.07180.13
7.4.100.0900.09080.14
7.4.90.0710.07180.12
7.4.80.0620.07580.07
7.4.70.0690.11980.03
7.4.60.0690.07080.09
7.4.50.0030.03579.92
7.4.40.0270.06180.17
7.4.30.0600.07680.10
7.4.00.0360.04678.32
7.3.330.0430.054137.36
7.3.320.0420.059137.05
7.3.310.0170.04079.82
7.3.300.0100.04479.97
7.3.290.0430.07979.92
7.3.280.0700.09679.98
7.3.270.0790.06379.94
7.3.260.0640.08080.01
7.3.250.0890.08079.92
7.3.240.0710.07180.11
7.3.230.0620.07980.14
7.3.210.0640.08580.01
7.3.200.0680.09779.87
7.3.190.0950.10380.20
7.3.180.0600.07780.12
7.3.170.0740.09480.14
7.3.160.0690.06980.04
7.3.120.0390.05978.65
7.2.330.0640.07880.40
7.2.320.0900.10780.32
7.2.310.0730.06280.01
7.2.300.0680.09480.13
7.2.290.0890.09680.14
7.2.60.2610.03478.70
7.1.200.1320.02678.08
7.1.100.3540.04780.33
7.1.70.0100.03279.12
7.1.60.0230.07379.75
7.1.50.0360.07979.22
7.1.00.0130.10084.54
7.0.200.5840.05078.40
7.0.140.0100.11384.23
7.0.60.0230.07383.67
7.0.50.0300.12381.39
7.0.40.0200.06020.07
7.0.30.0270.08020.32
7.0.20.0470.11020.33
7.0.10.0470.08720.18
7.0.00.0230.11020.19
5.6.280.0230.24786.07
5.6.210.0270.16385.45
5.6.200.0330.22783.14
5.6.190.0230.21385.32
5.6.180.0400.19785.36
5.6.170.0430.26785.32
5.6.160.0270.20385.40
5.6.150.0230.24083.08
5.6.140.0330.15783.13
5.6.130.0470.21383.14
5.6.120.0300.24385.97
5.6.110.0270.17785.97
5.6.100.0300.23385.93
5.6.90.0230.19385.98
5.6.80.0170.22385.42
5.6.70.0300.20785.39
5.5.350.0200.25785.39
5.5.340.0170.25082.91
5.5.330.0370.15085.24
5.5.320.0470.24084.94
5.5.310.0430.26384.93
5.5.300.0400.19782.89
5.5.290.0230.17382.92
5.5.280.0270.18785.86
5.5.270.0430.16385.81
5.5.260.0130.19085.77
5.5.250.0370.22785.63
5.5.240.0230.21785.33
5.4.450.1670.52084.55
5.4.440.1170.27084.08
5.4.430.1230.29784.23
5.4.420.0700.23384.50
5.4.410.1100.29384.40
5.4.400.0870.33083.92
5.4.390.1000.29783.82
5.4.380.0770.24783.58
5.4.370.0570.26083.79
5.4.360.0530.26783.54
5.4.350.0300.22677.10
5.4.340.0390.20177.10
5.4.320.0300.20177.59
5.4.310.0240.19977.58
5.4.300.0260.18877.59
5.4.290.0220.20677.58
5.4.280.0220.19777.48
5.4.270.0260.20177.48
5.4.260.0310.19577.48
5.4.250.0370.27083.89
5.4.240.0200.30383.84
5.4.230.0470.31083.53
5.4.220.0570.31083.79
5.4.210.0570.28783.69
5.4.200.0470.37783.79
5.4.190.0470.28783.82
5.4.180.0400.26783.56
5.4.170.0470.27083.91
5.4.160.0470.34083.70
5.4.150.0500.34783.54
5.4.140.0330.32081.39
5.4.130.0400.38781.32
5.4.120.0530.34781.34
5.4.110.0630.35381.38
5.4.100.0430.30081.30
5.4.90.0330.47381.46
5.4.80.0630.40781.29
5.4.70.0700.26381.44
5.4.60.0400.32381.33
5.4.50.0600.25781.48
5.4.40.0470.28081.43
5.4.30.0400.40381.47
5.4.20.0470.37781.47
5.4.10.0270.27781.29
5.4.00.0330.38380.88
5.3.290.0060.04812.80
5.3.280.0070.07314.83
5.3.270.0170.04314.57
5.3.260.0070.05314.63
5.3.250.0130.06314.68
5.3.240.0030.05314.78
5.3.230.0170.05714.77
5.3.220.0100.05714.65
5.3.210.0070.06314.55
5.3.200.0130.05314.64
5.3.190.0200.05314.59
5.3.180.0100.04714.46
5.3.170.0100.06714.65
5.3.160.0170.04314.65
5.3.150.0100.05314.48
5.3.140.0000.05714.66
5.3.130.0130.04714.63
5.3.120.0030.05314.53
5.3.110.0170.04714.62
5.3.100.0000.07314.18
5.3.90.0030.05714.18
5.3.80.0070.05714.01
5.3.70.0070.07314.12
5.3.60.0030.06013.92
5.3.50.0200.05313.85
5.3.40.0100.05013.96
5.3.30.0030.05314.00
5.3.20.0000.05713.54
5.3.10.0200.05013.83
5.3.00.0200.04713.63
5.2.170.0100.04010.96
5.2.160.0130.05011.04
5.2.150.0000.05311.09
5.2.140.0130.04311.27
5.2.130.0070.05711.10
5.2.120.0000.04711.26
5.2.110.0030.04311.27
5.2.100.0070.04011.16
5.2.90.0000.06311.18
5.2.80.0130.03711.25
5.2.70.0030.04311.09
5.2.60.0030.04311.23
5.2.50.0030.04311.08
5.2.40.0030.04311.08
5.2.30.0070.04711.04
5.2.20.0100.03711.04
5.2.10.0070.03710.95
5.2.00.0030.06010.71
5.1.60.0000.0509.83
5.1.50.0070.0339.91
5.1.40.0100.0409.96
5.1.30.0030.05010.40
5.1.20.0030.05010.18
5.1.10.0070.03310.22
5.1.00.0030.0479.89
5.0.50.0070.0278.55
5.0.40.0000.0438.39
5.0.30.0070.0478.27
5.0.20.0070.0308.28
5.0.10.0070.0308.00
5.0.00.0000.0578.08
4.4.90.0000.0236.23
4.4.80.0000.0336.23
4.4.70.0100.0236.23
4.4.60.0070.0206.23
4.4.50.0100.0136.23
4.4.40.0070.0336.23
4.4.30.0000.0236.23
4.4.20.0000.0236.23
4.4.10.0030.0276.23
4.4.00.0030.0336.23
4.3.110.0070.0276.23
4.3.100.0030.0236.23
4.3.90.0070.0236.23
4.3.80.0000.0376.23
4.3.70.0070.0176.23
4.3.60.0030.0276.23
4.3.50.0030.0236.23
4.3.40.0000.0376.23
4.3.30.0030.0306.23
4.3.20.0030.0206.23
4.3.10.0030.0306.23
4.3.00.0100.0276.62

preferences:
49.01 ms | 401 KiB | 5 Q