3v4l.org

run code in 200+ PHP versions simultaneously
<?php $menu = array( array(1,3,'Wurm 1.1', 2, 10), array(2,6,'Vogel 2.1', 2, 30), array(3,0,'Tiger 1', 1, 10), array(4,6,'Hund 2.2', 2, 40), array(5,3,'Katze 1.2', 2, 11), array(6,0,'Pferd 2', 1, 20), array(7,1,'Baer 1.1.1', 3, 0), array(8,3,'Schwein 1.3', 2, 12), array(9,4,'Esel 2.2.1', 3, 0), ); // Algorithmus hier uasort($menu, function($a,$b) { return $a[1] == $b[1] ? ($a[4] < $b[4] ? -1 : 1) : ($a[1] < $b[1] ? -1 : 1); }); $cache = array(); foreach ($menu as $m) { if (!isset($cache[$m[1]])) { $cache[$m[1]] = array(); } $cache[$m[1]][] = $m; } function m($m, $l, $r) { foreach($m[$l] as $e) { $r[] = $e; if (isset($m[$e[0]])) { $r = m($m, $e[0], $r); } } return $r; } $result = m($cache, 0, array()); $target = array( array(3,0,'Tiger 1', 1, 10), array(1,3,'Wurm 1.1', 2, 10), array(7,1,'Baer 1.1.1', 3, 0), array(5,3,'Katze 1.2', 2, 11), array(8,3,'Schwein 1.3', 2, 12), array(6,0,'Pferd 2', 1, 20), array(2,6,'Vogel 2.1', 2, 30), array(4,6,'Hund 2.2', 2, 40), array(9,4,'Esel 2.2.1', 3, 0), ); var_dump($result == $target);
based on gvZNV

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)
7.4.00.0030.01514.68
7.3.90.0040.01315.10
7.3.80.0240.00314.71
7.3.70.0070.01714.70
7.3.60.0130.00614.77
7.3.50.0060.00914.74
7.3.40.0130.00614.83
7.3.30.0180.00414.80
7.3.20.0170.00814.99
7.3.10.0170.00414.82
7.3.00.0100.00714.56
7.2.220.0130.00715.11
7.2.210.0170.00915.25
7.2.200.0060.01515.23
7.2.190.0080.00815.21
7.2.180.0070.00715.20
7.2.170.0130.01015.18
7.2.160.0110.00914.96
7.2.150.0350.01015.22
7.2.140.0150.00715.16
7.2.130.0150.01115.16
7.2.120.0230.00315.33
7.2.110.0160.01015.31
7.2.100.0180.00915.23
7.2.90.0570.00414.80
7.2.80.0640.01014.84
7.2.70.0640.01115.06
7.2.60.0360.00915.53
7.2.50.0500.00815.69
7.2.40.0810.01214.97
7.2.30.0740.01215.08
7.2.20.0790.00915.03
7.2.10.0760.00214.87
7.2.00.0790.00615.08
7.1.320.0140.00513.93
7.1.310.0120.01213.99
7.1.300.0080.00814.16
7.1.290.0120.00313.65
7.1.280.0070.01414.02
7.1.270.0110.01114.03
7.1.260.0130.00814.03
7.1.250.0160.00814.04
7.1.240.0140.00813.98
7.1.230.0260.01513.86
7.1.220.0080.01113.73
7.1.210.0780.01113.67
7.1.200.0660.00614.36
7.1.190.0870.00913.84
7.1.180.0700.01013.79
7.1.170.0880.00913.75
7.1.160.0730.00513.93
7.1.150.0940.00913.89
7.1.140.0720.00913.73
7.1.130.0650.00513.76
7.1.120.0620.01013.86
7.1.110.0730.01013.72
7.1.100.0540.00513.82
7.1.90.0330.01113.86
7.1.80.0660.00813.91
7.1.70.0070.01115.14
7.1.60.0370.01121.72
7.1.50.0830.01020.91
7.1.40.0230.00822.90
7.1.30.0770.00322.86
7.1.20.0600.01622.64
7.1.10.0340.01013.89
7.1.00.0340.02916.63
7.0.330.0180.00413.67
7.0.320.0140.01313.77
7.0.310.0560.00013.48
7.0.300.0920.00613.43
7.0.290.0950.00613.67
7.0.280.0860.00613.31
7.0.270.0580.01113.57
7.0.260.0910.00713.54
7.0.250.0760.00513.69
7.0.240.0950.00713.52
7.0.230.0290.00713.55
7.0.220.0190.00813.77
7.0.210.0160.00713.49
7.0.200.0120.00514.46
7.0.190.0150.01013.49
7.0.180.0190.00713.66
7.0.170.0560.00913.59
7.0.160.0530.01013.52
7.0.150.0390.00613.61
7.0.140.0550.01013.70
7.0.130.0470.01013.46
7.0.120.0600.00613.62
7.0.110.0510.01213.69
7.0.100.0550.00713.28
7.0.90.0400.00713.66
7.0.80.0430.00613.52
7.0.70.0190.03616.29
7.0.60.0280.03416.35
7.0.50.0290.02316.48
7.0.40.0210.02915.82
7.0.30.0280.03615.78
7.0.20.0300.03515.86
7.0.10.0300.03015.75
7.0.00.0390.02915.90
5.6.400.0090.00914.31
5.6.390.0080.01114.72
5.6.380.0030.01514.31
5.6.370.0170.00714.77
5.6.360.0070.01014.65
5.6.350.0090.00614.54
5.6.340.0000.02114.31
5.6.330.0160.00414.33
5.6.320.0120.00614.54
5.6.310.0140.00514.45
5.6.300.0090.00614.30
5.6.290.0100.00914.72
5.6.280.0130.01616.72
5.6.270.0190.00514.49
5.6.260.0170.00514.52
5.6.250.0100.01214.52
5.6.240.0140.00514.48
5.6.230.0150.00614.49
5.6.220.0140.00814.52
5.6.210.0120.03216.43
5.6.200.0090.03316.59
5.6.190.0110.02616.62
5.6.180.0090.03016.70
5.6.170.0110.03316.59
5.6.160.0080.03516.52
5.6.150.0130.03116.55
5.6.140.0100.03616.49
5.6.130.0060.02616.77
5.6.120.0070.03616.55
5.6.110.0110.03516.62
5.6.100.0080.02916.57
5.6.90.0120.02116.66
5.6.80.0130.02616.47
5.6.70.0110.01616.42
5.6.60.0100.02716.35
5.6.50.0110.03216.39
5.6.40.0080.03416.48
5.6.30.0090.03016.33
5.6.20.0110.03016.37
5.6.10.0130.02616.43
5.6.00.0090.03116.50
5.5.380.0140.00412.86
5.5.370.0160.00612.89
5.5.360.0160.00212.62
5.5.350.0090.02315.33
5.5.340.0070.03715.49
5.5.330.0100.03015.39
5.5.320.0150.02315.50
5.5.310.0050.03115.31
5.5.300.0090.02415.51
5.5.290.0110.02515.49
5.5.280.0100.03215.63
5.5.270.0070.03515.54
5.5.260.0090.02515.46
5.5.250.0060.02015.20
5.5.240.0050.02415.28
5.5.230.0100.02815.38
5.5.220.0100.02615.23
5.5.210.0060.03415.43
5.5.200.0110.02315.36
5.5.190.0110.02915.25
5.5.180.0120.02915.16
5.5.170.0140.01114.15
5.5.160.0090.02915.24
5.5.150.0110.02415.31
5.5.140.0110.01815.21
5.5.130.0100.03115.39
5.5.120.0090.02915.19
5.5.110.0080.03215.24
5.5.100.0090.02515.16
5.5.90.0100.02315.34
5.5.80.0100.02815.29
5.5.70.0080.03015.33
5.5.60.0060.03315.24
5.5.50.0060.03215.17
5.5.40.0110.02915.21
5.5.30.0070.03315.13
5.5.20.0090.03015.06
5.5.10.0110.02915.19
5.5.00.0090.02915.06
5.4.450.0070.02914.38
5.4.440.0070.03014.30
5.4.430.0080.03114.31
5.4.420.0090.02114.32
5.4.410.0070.01814.36
5.4.400.0120.02614.22
5.4.390.0110.02314.24
5.4.380.0090.02614.25
5.4.370.0070.03114.27
5.4.360.0070.03014.25
5.4.350.0120.02014.07
5.4.340.0070.02814.26
5.4.330.0140.00111.82
5.4.320.0030.02814.19
5.4.310.0090.02514.20
5.4.300.0080.02714.30
5.4.290.0060.02914.14
5.4.280.0090.02714.24
5.4.270.0080.02914.34
5.4.260.0080.02014.25
5.4.250.0070.02614.28
5.4.240.0060.02214.10
5.4.230.0100.02614.22
5.4.220.0060.03214.14
5.4.210.0080.02914.26
5.4.200.0130.02614.32
5.4.190.0070.02814.21
5.4.180.0100.02414.24
5.4.170.0090.02714.20
5.4.160.0090.02614.15
5.4.150.0070.02914.12
5.4.140.0030.03713.40
5.4.130.0100.02713.40
5.4.120.0110.02313.40
5.4.110.0080.02513.32
5.4.100.0060.02913.26
5.4.90.0100.02913.36
5.4.80.0060.03213.40
5.4.70.0060.02813.30
5.4.60.0070.02513.27
5.4.50.0080.01513.41
5.4.40.0100.02113.39
5.4.30.0090.02313.26
5.4.20.0060.02813.31
5.4.10.0120.01113.34
5.4.00.0050.03213.19
5.3.290.0100.00312.46
5.3.280.0090.00412.46
5.3.270.0080.00812.46
5.3.260.0130.00612.46
5.3.250.0140.00412.46
5.3.240.0060.00612.46
5.3.230.0040.00812.46
5.3.220.0060.00612.46
5.3.210.0040.00912.46
5.3.200.0140.00512.46
5.3.190.0110.00412.46
5.3.180.0060.00612.46
5.3.170.0100.00412.46
5.3.160.0120.00612.46
5.3.150.0120.00212.46
5.3.140.0030.01212.46
5.3.130.0050.01012.46
5.3.120.0090.00512.46
5.3.110.0070.00712.46
5.3.100.0100.00312.46
5.3.90.0040.00912.46
5.3.80.0100.00812.46
5.3.70.0050.01112.46
5.3.60.0030.01112.46
5.3.50.0040.00912.46
5.3.40.0090.00612.46
5.3.30.0100.00312.46
5.3.20.0090.00312.46
5.3.10.0120.00312.46
5.3.00.0000.01312.46
5.2.170.0080.00312.46
5.2.160.0050.00612.46
5.2.150.0000.01112.46
5.2.140.0070.00312.46
5.2.130.0050.00512.46
5.2.120.0090.00312.46
5.2.110.0040.00912.46
5.2.100.0130.00012.46
5.2.90.0040.00812.46
5.2.80.0140.00012.46
5.2.70.0110.00312.46
5.2.60.0030.01012.46
5.2.50.0000.01312.46
5.2.40.0050.00512.46
5.2.30.0030.00912.46
5.2.20.0070.00412.46
5.2.10.0090.00212.46
5.2.00.0070.00712.46
5.1.60.0080.00412.46
5.1.50.0060.00712.46
5.1.40.0040.00812.46
5.1.30.0130.00012.46
5.1.20.0030.01012.46
5.1.10.0040.00812.46
5.1.00.0130.00012.46
5.0.50.0060.00312.46
5.0.40.0090.00012.46
5.0.30.0060.00212.46
5.0.20.0070.00012.46
5.0.10.0060.00412.46
5.0.00.0000.01012.46
4.4.90.0090.00012.46
4.4.80.0000.00712.46
4.4.70.0000.00712.46
4.4.60.0030.00312.46
4.4.50.0000.00712.46
4.4.40.0060.00312.46
4.4.30.0000.00912.46
4.4.20.0040.00512.46
4.4.10.0070.00012.46
4.4.00.0060.00312.46
4.3.110.0070.00012.46
4.3.100.0050.00212.46
4.3.90.0080.00012.46
4.3.80.0000.00712.46
4.3.70.0000.00912.46
4.3.60.0100.00012.46
4.3.50.0090.00012.46
4.3.40.0000.00712.46
4.3.30.0020.00412.46
4.3.20.0060.00012.46
4.3.10.0030.00312.46
4.3.00.0000.00812.46