3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = "Football / Germany / 1.Liga Football / Germany / 1.Liga Football / Germany / 2.Liga Football / Germany / 2.Liga Football / Germany / 2.Liga Football / England / 1.Liga Football / England / 1.Liga Football / England / 2.Liga Football / England / 2.Liga Football / England / 3.Liga Hockey / Germany / 1.Liga Hockey / Germany / 1.Liga Hockey / Germany / 2.Liga Fechten / Meisterschaft Fechten / Meisterschaft Fechten / Weltmeister"; class ArrayStacker { public function stackArray($string) { $array = $this->splitString($string); $stackedArray = array(); foreach($array as $row) { $stackedArray[] = $this->_stack($row); } return $stackedArray; } /** * Split the whole string into a big array * * @param string $string * @return array */ protected function splitString($string) { $lines = explode("\n", $string); $i = 0; $array = array(); foreach($lines as $line) { $values = explode(' / ', $line); foreach($values as $v => $value) { $values[$v] = trim($value); // make sure we got no whitespaces } $array[$i] = $values; $i++; } return $array; } protected function _stack($array) { $stackedArray = array(); if(($key = array_shift($array)) != null) { $stackedArray[$key] = $this->_stack($array); } else { return null; } return $stackedArray; } } $arrayStacker = new ArrayStacker(); var_dump($arrayStacker->stackArray($string));

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.0100.00616.50
8.3.50.0110.01117.24
8.3.40.0040.01218.54
8.3.30.0090.00618.66
8.3.20.0040.00418.60
8.3.10.0060.00320.41
8.3.00.0040.00419.26
8.2.180.0040.01116.35
8.2.170.0140.00422.96
8.2.160.0080.00818.62
8.2.150.0000.00824.18
8.2.140.0060.00324.66
8.2.130.0040.00426.16
8.2.120.0040.00418.58
8.2.110.0060.00321.12
8.2.100.0030.01017.84
8.2.90.0000.01019.47
8.2.80.0040.00419.40
8.2.70.0070.00317.50
8.2.60.0000.00818.05
8.2.50.0040.00418.07
8.2.40.0030.00618.05
8.2.30.0080.00018.11
8.2.20.0000.00919.39
8.2.10.0050.00317.77
8.2.00.0000.00917.82
8.1.280.0090.01325.92
8.1.270.0000.00823.99
8.1.260.0110.01126.35
8.1.250.0040.00428.09
8.1.240.0190.00022.52
8.1.230.0060.00620.98
8.1.220.0000.00817.77
8.1.210.0030.00518.89
8.1.200.0090.00017.35
8.1.190.0000.00917.52
8.1.180.0030.00518.10
8.1.170.0030.00518.91
8.1.160.0050.00319.02
8.1.150.0040.00418.56
8.1.140.0030.00517.45
8.1.130.0040.00417.76
8.1.120.0000.00817.54
8.1.110.0050.00317.40
8.1.100.0000.00717.51
8.1.90.0000.00717.41
8.1.80.0040.00417.33
8.1.70.0040.00417.49
8.1.60.0030.00517.52
8.1.50.0040.00417.50
8.1.40.0080.00017.54
8.1.30.0000.00817.53
8.1.20.0040.00417.70
8.1.10.0000.00817.59
8.1.00.0040.00417.52
8.0.300.0000.00719.86
8.0.290.0080.00016.63
8.0.280.0080.00018.47
8.0.270.0040.00417.28
8.0.260.0070.00016.84
8.0.250.0050.00216.88
8.0.240.0000.00816.89
8.0.230.0000.00716.88
8.0.220.0070.00016.88
8.0.210.0050.00316.86
8.0.200.0030.00316.85
8.0.190.0040.00416.87
8.0.180.0040.00416.93
8.0.170.0040.00416.86
8.0.160.0000.00716.95
8.0.150.0060.00316.79
8.0.140.0100.00016.87
8.0.130.0030.00313.35
8.0.120.0070.00016.91
8.0.110.0080.00016.72
8.0.100.0000.00816.99
8.0.90.0000.00716.82
8.0.80.0070.01016.89
8.0.70.0030.00516.89
8.0.60.0040.00416.80
8.0.50.0000.00816.91
8.0.30.0090.01217.09
8.0.20.0080.01517.04
8.0.10.0040.00416.95
8.0.00.0120.01116.69
7.4.330.0000.00512.96
7.4.320.0000.00616.64
7.4.300.0050.00316.52
7.4.290.0030.00316.52
7.4.280.0090.00016.43
7.4.270.0030.00316.65
7.4.260.0000.00513.41
7.4.250.0040.00416.54
7.4.240.0040.00416.64
7.4.230.0080.00016.74
7.4.220.0110.00716.63
7.4.210.0090.00616.67
7.4.200.0070.00016.63
7.4.190.0040.00416.71
7.4.160.0030.01416.65
7.4.150.0060.01316.51
7.4.140.0150.00916.57
7.4.130.0110.00816.58
7.4.120.0090.01216.55
7.4.110.0140.00716.37
7.4.100.0090.00916.55
7.4.90.0070.01116.48
7.4.80.0090.00916.57
7.4.70.0110.01116.60
7.4.60.0060.01016.62
7.4.50.0020.00216.37
7.4.40.0040.00816.62
7.4.30.0070.01016.60
7.4.00.0090.00915.01
7.3.330.0030.00313.22
7.3.320.0060.00013.23
7.3.310.0040.00416.31
7.3.300.0000.00716.35
7.3.290.0050.01016.38
7.3.280.0090.00916.38
7.3.270.0110.00816.57
7.3.260.0180.00616.50
7.3.250.0060.02016.52
7.3.240.0150.00916.63
7.3.230.0090.00916.45
7.3.210.0130.00616.57
7.3.200.0090.01219.39
7.3.190.0090.00916.29
7.3.180.0090.01116.50
7.3.170.0140.00516.66
7.3.160.0100.01316.29
7.3.120.0090.00915.05
7.2.330.0150.00616.59
7.2.320.0110.01216.72
7.2.310.0080.01516.85
7.2.300.0120.00916.88
7.2.290.0120.00716.45
7.2.60.0030.00916.85
7.2.00.0100.00319.18
7.1.200.0070.00315.82
7.1.100.0170.01017.66
7.1.70.0070.00716.88
7.1.60.0090.01519.30
7.1.50.0040.01816.77
7.1.00.0000.03722.35
7.0.200.0030.00316.49
7.0.140.0000.08022.00
7.0.120.0030.07022.25
7.0.60.0030.04020.02
7.0.50.0100.05017.89
7.0.40.0130.05720.27
7.0.30.0200.05720.17
7.0.20.0230.04020.25
7.0.10.0330.08320.12
7.0.00.0070.04020.44
5.6.280.0070.07320.82
5.6.210.0070.04320.76
5.6.200.0030.08318.18
5.6.190.0070.07720.55
5.6.180.0300.05020.46
5.6.170.0230.07320.56
5.6.160.0030.06020.40
5.6.150.0070.05018.18
5.6.140.0070.04018.24
5.6.130.0070.04318.24
5.6.120.0000.07321.05
5.6.110.0100.07321.13
5.6.100.0100.07720.98
5.6.90.0100.06321.01
5.6.80.0100.07720.30
5.6.70.0200.04020.36
5.5.350.0300.07720.39
5.5.340.0030.04017.98
5.5.330.0070.03720.42
5.5.320.0230.04020.36
5.5.310.0330.07020.28
5.5.300.0070.08717.95
5.5.290.0100.06318.04
5.5.280.0030.04320.98
5.5.270.0070.04720.77
5.5.260.0070.03720.97
5.5.250.0070.03720.59
5.5.240.0070.03720.05
5.4.450.0070.04019.48
5.4.440.0070.05319.57
5.4.430.0100.08019.46
5.4.420.0030.05019.47
5.4.410.0130.03019.05
5.4.400.0070.06019.15
5.4.390.0070.06319.08
5.4.380.0030.04019.14
5.4.370.0070.05719.14
5.4.360.0030.07719.14
5.4.350.0030.06319.20
5.4.340.0100.04718.86
5.4.320.0070.07718.86
5.4.310.0100.06718.86
5.4.300.0030.07719.24
5.4.290.0100.04319.28
5.4.280.0070.08019.14
5.4.270.0070.08018.85
5.4.260.0030.08019.24
5.4.250.0100.06718.84
5.4.240.0200.06719.14
5.4.230.0000.05319.24
5.4.220.0070.06019.14
5.4.210.0030.07019.19
5.4.200.0070.04019.19
5.4.190.0170.07018.84
5.4.180.0170.05718.86
5.4.170.0070.06319.15
5.4.160.0000.05319.10
5.4.150.0070.03319.22
5.4.140.0100.04016.52
5.4.130.0070.03316.43
5.4.120.0030.03716.45
5.4.110.0030.05016.56
5.4.100.0000.08316.67
5.4.90.0030.04016.39
5.4.80.0130.06716.41
5.4.70.0030.07716.39
5.4.60.0030.07716.39
5.4.50.0030.03716.40
5.4.40.0200.05716.37
5.4.30.0100.04716.37
5.4.20.0070.07316.41
5.4.10.0070.07716.48
5.4.00.0070.05315.90
5.3.290.0070.06314.73
5.3.280.0100.07314.77
5.3.270.0270.02714.66
5.3.260.0070.07714.64
5.3.250.0030.07314.67
5.3.240.0030.04314.67
5.3.230.0030.04314.63
5.3.220.0130.04014.65
5.3.210.0030.08014.67
5.3.200.0070.03714.74
5.3.190.0030.08314.52
5.3.180.0170.06014.64
5.3.170.0100.04714.49
5.3.160.0070.03714.60
5.3.150.0070.03714.76
5.3.140.0070.06714.60
5.3.130.0030.04714.57
5.3.120.0070.07314.58
5.3.110.0070.08014.60
5.3.100.0100.06314.11
5.3.90.0100.07714.06
5.3.80.0030.07714.01
5.3.70.0000.05314.07
5.3.60.0030.04314.19
5.3.50.0070.04014.03
5.3.40.0170.03713.99
5.3.30.0070.05713.94
5.3.20.0130.06713.79
5.3.10.0070.04013.68
5.3.00.0070.03313.81
5.2.170.0000.03311.18
5.2.160.0000.06311.17
5.2.150.0070.05311.25
5.2.140.0100.05711.25
5.2.130.0070.04011.21
5.2.120.0070.03711.19
5.2.110.0000.03311.08
5.2.100.0070.02711.18
5.2.90.0070.04311.12
5.2.80.0000.03711.12
5.2.70.0000.04011.27
5.2.60.0130.05711.16
5.2.50.0000.04011.01
5.2.40.0100.05711.07
5.2.30.0100.04311.04
5.2.20.0030.06711.15
5.2.10.0070.02310.89
5.2.00.0070.02710.76
5.1.60.0100.05010.05
5.1.50.0000.0579.98
5.1.40.0070.05010.06
5.1.30.0030.05710.41
5.1.20.0030.05310.39
5.1.10.0030.05710.25
5.1.00.0000.03310.15
5.0.50.0030.0208.55
5.0.40.0100.0378.55
5.0.30.0030.0408.55
5.0.20.0070.0308.55
5.0.10.0100.0278.55
5.0.00.0030.0678.55
4.4.90.0000.0178.29
4.4.80.0000.0308.35
4.4.70.0000.0238.46
4.4.60.0030.0208.46
4.4.50.0030.0178.48
4.4.40.0000.0538.55
4.4.30.0000.0278.55
4.4.20.0030.0338.55
4.4.10.0000.0278.55
4.4.00.0030.0378.55
4.3.110.0070.0178.55
4.3.100.0000.0208.55
4.3.90.0000.0178.55
4.3.80.0000.0538.55
4.3.70.0000.0308.55
4.3.60.0070.0308.55
4.3.50.0030.0238.55
4.3.40.0000.0378.55
4.3.30.0000.0408.55
4.3.20.0000.0208.55
4.3.10.0000.0408.55
4.3.00.0000.0378.55

preferences:
43.48 ms | 400 KiB | 5 Q