3v4l.org

run code in 300+ PHP versions simultaneously
<?php class testCase { private $stores; /* $out not having default value so type not inferred */ /* names very vague */ public function doFunction($items = array(), $out ) { foreach($items as $num => $val) { /* lots of overriding of output here, seems like += or concat */ if($num%2 == 0) { $out = $val; } else { $out = strtoupper($val); } /* WHY DO ALL OF THE ABOVE IF WE'RE GOING TO OVERRIDE IT WITH THIS ANYWAY? */ //$out = "<br />"; } return $this->store = $out; } /* PRIVATE, SO NOT ACCESSIBLE! FIX: make public */ /* name is vague */ private function unFunction($items = '', $out = array()) { $items = implode("<br >", $items, -1); foreach($items as $num => $val) { if($num%2 != 0) { $out[$num] = $val; } else { $out[$num] = strtlower($val); } } echo $out; } } class testCase1 { public $store; public function doFunction($items = array(), $out = '') { foreach($items as $num => $val) { if($num % 2 === 0) { $out .= $val; } else { $out .= strtoupper($val); } $out .= "<br />"; } return $this->store = $out; } public function unFunction($items = '', $out = array()) { $items = explode("<br />", $items); foreach($items as $num => $val) { if($num % 2 !== 0) { $out[$num] = $val; } else { $out[$num] = strtolower($val); } } return $out; } } $test = new testCase1(); echo $test->doFunction(array_merge(range(0,25), range('a','z'))) . "<hr />"; print_r($test->unFunction($test->store)); //echo $test->doFunction(array_merge(range(0,25)), "test"); /* seems like the two functions are about: doing something and undoing that. */ ?>

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.0070.00718.92
8.3.30.0070.00719.07
8.3.20.0080.00020.33
8.3.10.0050.00322.13
8.3.00.0000.00822.35
8.2.170.0070.00722.96
8.2.160.0140.00020.29
8.2.150.0000.00824.18
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0040.00419.48
8.2.110.0060.00320.49
8.2.100.0060.00619.64
8.2.90.0080.00019.18
8.2.80.0060.00317.97
8.2.70.0030.00517.50
8.2.60.0000.00817.80
8.2.50.0040.00418.07
8.2.40.0000.00818.15
8.2.30.0000.00818.04
8.2.20.0040.00417.81
8.2.10.0040.00419.64
8.2.00.0030.00517.83
8.1.270.0030.00622.02
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0030.00723.91
8.1.230.0090.00318.97
8.1.220.0050.00317.91
8.1.210.0000.00818.77
8.1.200.0070.00317.35
8.1.190.0040.00417.51
8.1.180.0060.00318.10
8.1.170.0030.00618.47
8.1.160.0000.00722.05
8.1.150.0040.00418.52
8.1.140.0070.00017.41
8.1.130.0000.00717.93
8.1.120.0070.00017.34
8.1.110.0000.00817.46
8.1.100.0040.00417.46
8.1.90.0000.00717.36
8.1.80.0040.00417.52
8.1.70.0000.00717.45
8.1.60.0050.00317.46
8.1.50.0030.00717.54
8.1.40.0000.00817.45
8.1.30.0000.00717.51
8.1.20.0030.00517.75
8.1.10.0000.00817.70
8.1.00.0030.00617.57
8.0.300.0040.00418.77
8.0.290.0000.00717.28
8.0.280.0030.00318.36
8.0.270.0070.00017.27
8.0.260.0000.00716.97
8.0.250.0000.00717.07
8.0.240.0000.00717.04
8.0.230.0080.00017.08
8.0.220.0030.00316.92
8.0.210.0000.00716.89
8.0.200.0000.00717.00
8.0.190.0000.00717.10
8.0.180.0050.00217.07
8.0.170.0000.00817.02
8.0.160.0040.00417.03
8.0.150.0070.00016.96
8.0.140.0040.00416.95
8.0.130.0030.00313.39
8.0.120.0040.00417.00
8.0.110.0070.00016.86
8.0.100.0050.00216.82
8.0.90.0000.00717.03
8.0.80.0080.00817.09
8.0.70.0050.00316.91
8.0.60.0060.00316.96
8.0.50.0020.00516.79
8.0.30.0110.01117.15
8.0.20.0120.00917.40
8.0.10.0000.00816.98
8.0.00.0030.01716.93
7.4.330.0030.00315.00
7.4.320.0000.00616.50
7.4.300.0030.00316.63
7.4.290.0080.00316.68
7.4.280.0070.00016.63
7.4.270.0000.00716.57
7.4.260.0000.00716.52
7.4.250.0050.00316.53
7.4.240.0030.00516.57
7.4.230.0070.00016.65
7.4.220.0090.00816.47
7.4.210.0050.01016.62
7.4.200.0070.00016.65
7.4.190.0030.00316.77
7.4.160.0100.00716.62
7.4.150.0170.00317.40
7.4.140.0070.01017.86
7.4.130.0100.01116.47
7.4.120.0130.00316.58
7.4.110.0100.00616.40
7.4.100.0070.01516.58
7.4.90.0120.00916.45
7.4.80.0130.00319.39
7.4.70.0120.00416.49
7.4.60.0130.00316.36
7.4.50.0070.00016.74
7.4.40.0060.00622.77
7.4.30.0030.01416.59
7.4.10.0040.01114.61
7.4.00.0050.01214.84
7.3.330.0050.00013.22
7.3.320.0000.00613.34
7.3.310.0040.00416.44
7.3.300.0000.00716.30
7.3.290.0130.00916.41
7.3.280.0090.00916.37
7.3.270.0170.00717.40
7.3.260.0040.01516.67
7.3.250.0100.01016.50
7.3.240.0130.00316.50
7.3.230.0000.01616.39
7.3.210.0070.01016.35
7.3.200.0110.00916.34
7.3.190.0200.00316.55
7.3.180.0160.00016.52
7.3.170.0060.01516.69
7.3.160.0090.00616.69
7.3.130.0100.00714.93
7.3.120.0090.00614.71
7.3.110.0090.00915.11
7.3.100.0070.00714.95
7.3.90.0000.01415.00
7.3.80.0110.00314.59
7.3.70.0110.00414.84
7.3.60.0030.00914.82
7.3.50.0080.00414.80
7.3.40.0070.00714.71
7.3.30.0090.00314.95
7.3.20.0110.00016.68
7.3.10.0040.00916.84
7.3.00.0140.00016.48
7.2.330.0180.00016.81
7.2.320.0190.00316.92
7.2.310.0090.00616.67
7.2.300.0000.01816.90
7.2.290.0080.00816.54
7.2.260.0090.00915.18
7.2.250.0040.01415.09
7.2.240.0030.00914.93
7.2.230.0050.00514.59
7.2.220.0120.00015.12
7.2.210.0000.00914.87
7.2.200.0000.00914.88
7.2.190.0030.00615.21
7.2.180.0040.00815.15
7.2.170.0090.00614.71
7.2.160.0100.00014.86
7.2.150.0030.00916.84
7.2.140.0080.00316.93
7.2.130.0100.00716.86
7.2.120.0090.00616.60
7.2.110.0060.01116.90
7.2.100.0070.01016.87
7.2.90.0130.00016.95
7.2.80.0030.01316.89
7.2.70.0090.00917.01
7.2.60.0090.00316.63
7.2.50.0060.00916.77
7.2.40.0030.01216.75
7.2.30.0030.01017.09
7.2.20.0060.00317.10
7.2.10.0060.00616.89
7.2.00.0060.00617.11
7.1.330.0070.01015.69
7.1.320.0060.00415.62
7.1.310.0060.00615.61
7.1.300.0000.01315.76
7.1.290.0040.00815.83
7.1.280.0040.00415.46
7.1.270.0030.00615.61
7.1.260.0140.00015.71
7.1.250.0060.01215.66
7.1.240.0030.00615.90
7.1.230.0100.00315.94
7.1.220.0030.01015.89
7.1.210.0030.01015.88
7.1.200.0090.01115.66
7.1.190.0100.00715.70
7.1.180.0060.00315.77
7.1.170.0060.00615.67
7.1.160.0080.00615.82
7.1.150.0090.00315.82
7.1.140.0070.00715.75
7.1.130.0060.00915.77
7.1.120.0030.00915.61
7.1.110.0000.01215.40
7.1.100.0030.00515.73
7.1.90.0070.00315.78
7.1.80.0030.01015.59
7.1.70.0040.00416.37
7.1.60.0040.00916.56
7.1.50.0070.00816.39
7.1.40.0070.00316.00
7.1.30.0030.00715.74
7.1.20.0080.00015.50
7.1.10.0040.00415.75
7.1.00.0080.03619.02
7.0.330.0050.00515.29
7.0.320.0060.00915.27
7.0.310.0100.00315.26
7.0.300.0000.01415.58
7.0.290.0030.00715.45
7.0.280.0040.01215.52
7.0.270.0000.01415.30
7.0.260.0060.00615.26
7.0.250.0030.00815.46
7.0.240.0030.01115.38
7.0.230.0040.00415.41
7.0.220.0100.00315.17
7.0.210.0000.01415.29
7.0.200.0050.01016.06
7.0.190.0060.00815.48
7.0.180.0030.01015.24
7.0.170.0040.01415.54
7.0.160.0110.00015.57
7.0.150.0050.00315.26
7.0.140.0000.04418.76
7.0.130.0120.00315.47
7.0.120.0000.00915.48
7.0.110.0030.00615.32
7.0.100.0150.00015.52
7.0.90.0100.00315.42
7.0.80.0090.00315.43
7.0.70.0050.00515.35
7.0.60.0100.04217.62
7.0.50.0080.02016.71
7.0.40.0080.04716.80
7.0.30.0200.04316.91
7.0.20.0120.02616.78
7.0.10.0080.02516.90
7.0.00.0130.03516.69
5.6.400.0080.01114.75
5.6.390.0060.00614.63
5.6.380.0100.00714.46
5.6.370.0000.01514.66
5.6.360.0080.00414.41
5.6.350.0040.01114.38
5.6.340.0050.00514.14
5.6.330.0040.01114.33
5.6.320.0120.00314.75
5.6.310.0040.01214.20
5.6.300.0080.00414.37
5.6.290.0090.00314.54
5.6.280.0050.03917.81
5.6.270.0030.00614.43
5.6.260.0030.00914.35
5.6.250.0080.00814.19
5.6.240.0060.00614.57
5.6.230.0030.00914.64
5.6.220.0070.01014.54
5.6.210.0070.04517.58
5.6.200.0060.04216.40
5.6.190.0090.02217.34
5.6.180.1920.03117.41
5.6.170.0170.02917.61
5.6.160.0030.03217.45
5.6.150.0100.02516.29
5.6.140.0080.04516.42
5.6.130.0050.02416.22
5.6.120.0110.02317.67
5.6.110.0050.05017.72
5.6.100.0130.04017.75
5.6.90.0070.04717.78
5.6.80.0110.02617.56
5.6.70.2250.02417.48
5.6.60.0030.01214.33
5.6.50.0060.01214.54
5.6.40.0190.00014.28
5.6.30.0100.00614.33
5.6.20.0030.01014.51
5.6.10.0080.00514.26
5.6.00.0100.00314.35
5.5.380.0040.00714.34
5.5.370.0080.00414.57
5.5.360.0070.00714.63
5.5.350.0070.03517.46
5.5.340.0060.04216.08
5.5.330.0180.02117.26
5.5.320.0230.04317.41
5.5.310.0230.02617.49
5.5.300.0040.04016.12
5.5.290.0080.02216.27
5.5.280.0090.04217.65
5.5.270.0020.05217.62
5.5.260.0070.04417.63
5.5.250.0100.03217.66
5.5.240.0190.03317.32
5.5.230.0070.01014.43
5.5.220.0030.01014.39
5.5.210.0060.01214.43
5.5.200.0120.00014.32
5.5.190.0070.01114.38
5.5.180.0090.00614.47
5.5.170.0030.01314.20
5.5.160.0110.00414.36
5.5.150.0080.00814.24
5.5.140.0100.01014.23
5.5.130.0030.01614.42
5.5.120.0130.00314.45
5.5.110.0060.00314.32
5.5.100.0000.01514.14
5.5.90.0000.01514.34
5.5.80.0030.01214.29
5.5.70.0050.00514.53
5.5.60.0080.00414.50
5.5.50.0080.00814.33
5.5.40.0060.00614.63
5.5.30.0070.01014.38
5.5.20.0090.00314.32
5.5.10.0000.01314.05
5.5.00.0060.00914.54
5.4.450.0050.03315.30
5.4.440.0300.03215.33
5.4.430.0060.04315.35
5.4.420.0050.03115.53
5.4.410.0050.03015.48
5.4.400.0460.00315.15
5.4.390.0480.00215.04
5.4.380.0160.03514.96
5.4.370.0100.03014.89
5.4.360.0070.03314.88
5.4.350.0110.03015.02
5.4.340.0140.02714.84
5.4.330.0030.00911.32
5.4.320.0070.02311.83
5.4.310.0020.02611.97
5.4.300.0020.02711.69
5.4.290.0050.02511.82
5.4.280.0070.02311.79
5.4.270.0160.03115.18
5.4.260.0070.03515.03
5.4.250.0100.04015.02
5.4.240.0090.03315.07
5.4.230.0080.03314.94
5.4.220.0080.04215.15
5.4.210.0070.03015.07
5.4.200.0050.04015.18
5.4.190.0050.04215.08
5.4.180.0080.02814.97
5.4.170.0090.03215.16
5.4.160.0080.03014.97
5.4.150.0070.04215.08
5.4.140.0080.04013.71
5.4.130.0130.03013.81
5.4.120.0120.03013.88
5.4.110.0070.03013.80
5.4.100.0030.04813.95
5.4.90.0080.02913.82
5.4.80.0070.02814.00
5.4.70.0080.03413.90
5.4.60.0050.03113.91
5.4.50.0150.03113.88
5.4.40.0080.02713.93
5.4.30.0030.03313.84
5.4.20.0040.02913.76
5.4.10.0120.03213.65
5.4.00.0100.02613.47
5.3.290.0040.02511.67
5.3.280.0060.03812.52
5.3.270.0070.04012.77
5.3.260.0080.03812.48
5.3.250.0110.02612.73
5.3.240.0060.02812.64
5.3.230.0030.03612.67
5.3.220.0070.03812.57
5.3.210.0050.03012.71
5.3.200.0070.03012.67
5.3.190.0110.03312.70
5.3.180.0080.02912.54
5.3.170.0100.02912.71
5.3.160.0090.03512.72
5.3.150.0070.03812.65
5.3.140.0080.03512.62
5.3.130.0130.02312.71
5.3.120.0150.03212.57
5.3.110.0070.04112.68
5.3.100.0080.02512.22
5.3.90.0110.03712.36
5.3.80.0070.03312.35
5.3.70.0100.03512.27
5.3.60.0070.02512.20
5.3.50.0080.03512.31
5.3.40.0050.02812.29
5.3.30.0050.03012.28
5.3.20.0080.03612.12
5.3.10.0110.03611.99
5.3.00.0050.03911.95
5.2.170.0200.05011.27
5.2.160.0130.05011.24
5.2.150.0100.03711.25
5.2.140.0030.04710.99
5.2.130.0070.05011.35
5.2.120.0130.05011.21
5.2.110.0030.04011.03
5.2.100.0170.03011.20
5.2.90.0130.04711.10
5.2.80.0070.05711.10
5.2.70.0130.05711.10
5.2.60.0030.04711.05
5.2.50.0170.05711.13
5.2.40.0030.04311.09
5.2.30.0130.04310.91
5.2.20.0030.06011.07
5.2.10.0000.05710.89
5.2.00.0070.05310.75
5.1.60.0070.04310.09
5.1.50.0030.05310.23
5.1.40.0100.0479.97
5.1.30.0070.04710.35
5.1.20.0100.05010.29
5.1.10.0100.04710.09
5.1.00.0130.04310.13
5.0.50.0070.0338.50
5.0.40.0070.0238.64
5.0.30.0070.0438.31
5.0.20.0070.0278.29
5.0.10.0100.0308.20
5.0.00.0070.0408.11
4.4.90.0030.0236.73
4.4.80.0000.0236.73
4.4.70.0030.0306.73
4.4.60.0000.0306.73
4.4.50.0030.0236.73
4.4.40.0000.0436.73
4.4.30.0000.0236.73
4.4.20.0100.0276.73
4.4.10.0000.0276.73
4.4.00.0030.0436.73
4.3.110.0070.0276.73
4.3.100.0000.0236.73
4.3.90.0030.0306.73
4.3.80.0070.0376.73
4.3.70.0030.0206.73
4.3.60.0000.0306.73
4.3.50.0030.0206.73
4.3.40.0000.0506.73
4.3.30.0130.0206.73
4.3.20.0000.0236.73
4.3.10.0000.0276.73
4.3.00.0170.0176.51

preferences:
39.04 ms | 400 KiB | 5 Q