3v4l.org

run code in 300+ PHP versions simultaneously
<?php class testCase { private $stores; public function doFunction($items = array(), $out ) { foreach($items as $num => $val) { 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? */ //$out = "<br />"; } return $this->store = $out; } /* PRIVATE, SO NOT ACCESSIBLE! FIX: make public */ 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 { private $stores; public function doFunction($items = array(), $out = "") { foreach($items as $num => $val) { if($num % 2 == 0) { $out += (string)$val; } else { $out += strtoupper($val); } $out += "<br />"; } return $this->store = $out; } 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; } } $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.60.0140.00718.43
8.3.50.0140.00322.04
8.3.40.0070.01118.79
8.3.30.0110.00419.34
8.3.20.0090.00020.16
8.3.10.0000.00822.09
8.3.00.0070.00022.27
8.2.180.0040.01117.00
8.2.170.0040.01122.96
8.2.160.0120.00622.25
8.2.150.0000.00824.18
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0070.00319.48
8.2.110.0090.00021.97
8.2.100.0080.00419.76
8.2.90.0000.00819.22
8.2.80.0000.00918.16
8.2.70.0080.00017.50
8.2.60.0040.00417.93
8.2.50.0080.00018.07
8.2.40.0050.00218.22
8.2.30.0040.00418.14
8.2.20.0000.00717.71
8.2.10.0050.00319.45
8.2.00.0090.00017.89
8.1.280.0100.00725.92
8.1.270.0080.00022.24
8.1.260.0080.00026.35
8.1.250.0000.00828.09
8.1.240.0060.00323.66
8.1.230.0070.00419.00
8.1.220.0080.00017.74
8.1.210.0030.00518.77
8.1.200.0000.01117.35
8.1.190.0040.00417.40
8.1.180.0040.00418.10
8.1.170.0070.00418.64
8.1.160.0070.00021.95
8.1.150.0000.00718.56
8.1.140.0000.00817.48
8.1.130.0030.00317.91
8.1.120.0000.00717.52
8.1.110.0040.00417.48
8.1.100.0040.00417.50
8.1.90.0000.00817.49
8.1.80.0030.00517.45
8.1.70.0070.00017.43
8.1.60.0080.00017.51
8.1.50.0020.00517.53
8.1.40.0040.00417.56
8.1.30.0050.00217.62
8.1.20.0050.00317.59
8.1.10.0040.00417.46
8.1.00.0000.00817.59
8.0.300.0040.00418.77
8.0.290.0070.00017.04
8.0.280.0000.00818.41
8.0.270.0030.00317.29
8.0.260.0030.00316.78
8.0.250.0000.00716.94
8.0.240.0040.00417.03
8.0.230.0080.00016.94
8.0.220.0030.00316.88
8.0.210.0030.00316.96
8.0.200.0000.00617.08
8.0.190.0030.00516.99
8.0.180.0040.00416.89
8.0.170.0030.00616.98
8.0.160.0000.00817.04
8.0.150.0000.00716.83
8.0.140.0040.00416.98
8.0.130.0000.00613.39
8.0.120.0040.00416.84
8.0.110.0000.00716.90
8.0.100.0050.00317.09
8.0.90.0040.00416.97
8.0.80.0120.00616.96
8.0.70.0040.00416.98
8.0.60.0040.00416.93
8.0.50.0080.00016.87
8.0.30.0100.01017.17
8.0.20.0110.00817.41
8.0.10.0040.00417.06
8.0.00.0090.01316.72
7.4.330.0080.00015.00
7.4.320.0030.00316.50
7.4.300.0000.00616.63
7.4.290.0030.00616.44
7.4.280.0040.00416.46
7.4.270.0030.00316.67
7.4.260.0110.00016.54
7.4.250.0060.00316.52
7.4.240.0020.00516.49
7.4.230.0040.00416.63
7.4.220.0060.01916.46
7.4.210.0060.01116.55
7.4.200.0040.00416.42
7.4.190.0000.00816.47
7.4.160.0140.00316.67
7.4.150.0070.01117.40
7.4.140.0120.00817.86
7.4.130.0110.01016.52
7.4.120.0090.01016.49
7.4.110.0070.01016.52
7.4.100.0120.01116.68
7.4.90.0140.01016.41
7.4.80.0090.00919.39
7.4.70.0030.02116.52
7.4.60.0050.01116.58
7.4.50.0030.00316.52
7.4.40.0030.01322.77
7.4.30.0090.00916.51
7.4.00.0070.00715.00
7.3.330.0030.00313.46
7.3.320.0030.00313.35
7.3.310.0070.00016.42
7.3.300.0030.00316.34
7.3.290.0130.00716.40
7.3.280.0100.00516.39
7.3.270.0150.00917.40
7.3.260.0140.00316.53
7.3.250.0090.01316.41
7.3.240.0150.00416.64
7.3.230.0060.01116.43
7.3.210.0080.01116.52
7.3.200.0030.01419.39
7.3.190.0120.00916.38
7.3.180.0130.00316.47
7.3.170.0100.01016.68
7.3.160.0130.00716.39
7.3.120.0070.01114.85
7.2.330.0160.00316.86
7.2.320.0090.00916.74
7.2.310.0030.01516.61
7.2.300.0070.01116.68
7.2.290.0130.01016.63
7.2.60.0110.00416.96
7.2.00.0000.00919.06
7.1.200.0120.00615.86
7.1.70.0000.01017.22
7.1.60.0060.00617.19
7.1.50.0150.01517.11
7.1.00.0000.08022.40
7.0.200.0050.00216.70
7.0.140.0000.07322.05
7.0.60.0030.08320.05
7.0.50.0100.06717.89
7.0.40.0070.09020.06
7.0.30.0370.07720.23
7.0.20.0200.03720.09
7.0.10.0200.05020.08
7.0.00.0230.07320.09
5.6.210.0100.07720.51
5.6.200.0100.08018.21
5.6.190.0000.08020.77
5.6.180.3870.04720.68
5.6.170.0130.04720.62
5.6.160.0100.08720.43
5.6.150.0100.05718.18
5.6.140.0070.04018.19
5.6.130.0100.07718.14
5.6.120.0030.08721.00
5.6.110.0130.07321.10
5.6.100.0100.07721.12
5.6.90.0070.08320.98
5.6.80.0130.07020.38
5.6.70.0270.06020.38
5.5.350.0030.05320.34
5.5.340.0100.05017.98
5.5.330.0030.05320.14
5.5.320.0230.08020.37
5.5.310.0230.08720.25
5.5.300.0100.04718.04
5.5.290.0030.05718.08
5.5.280.0070.07320.75
5.5.270.0170.06720.89
5.5.260.0030.06020.78
5.5.250.0000.05720.57
5.5.240.0100.04720.17
5.4.450.0130.06019.20
5.4.440.0930.04319.61
5.4.430.0200.04319.68
5.4.420.0030.06019.51
5.4.410.0030.06019.46
5.4.400.0870.00018.55
5.4.390.0900.00018.50
5.4.380.0330.04718.79
5.4.370.0100.05718.61
5.4.360.0200.04718.71
5.4.350.0200.05018.85
5.4.340.0130.05318.76
5.4.320.0060.04012.52
5.4.310.0090.03812.51
5.4.300.0050.04112.52
5.4.290.0060.04112.52
5.4.280.0030.03912.41
5.4.270.0070.07718.99
5.4.260.0130.07318.95
5.4.250.0000.06019.00
5.4.240.0030.06018.97
5.4.230.0170.07018.98
5.4.220.0230.06018.80
5.4.210.0130.07318.98
5.4.200.0070.05718.84
5.4.190.0200.05018.79
5.4.180.0070.07018.84
5.4.170.0170.05018.78
5.4.160.0030.06019.08
5.4.150.0230.04318.82
5.4.140.0130.07016.48
5.4.130.0070.05016.47
5.4.120.0130.04316.52
5.4.110.0000.07716.62
5.4.100.0100.07016.54
5.4.90.0200.04716.54
5.4.80.0170.06316.38
5.4.70.0130.05716.40
5.4.60.0130.06016.60
5.4.50.0130.05016.52
5.4.40.0070.06016.54
5.4.30.0130.04716.59
5.4.20.0070.05016.45
5.4.10.0030.07316.26
5.4.00.0170.05315.79
5.3.290.0060.04212.80
5.3.280.0130.04714.45
5.3.270.0030.05714.71
5.3.260.0070.06714.79
5.3.250.0030.05714.53
5.3.240.0030.06014.65
5.3.230.0100.06314.84
5.3.220.0100.06314.58
5.3.210.0100.06314.68
5.3.200.0130.04714.81
5.3.190.0200.06314.58
5.3.180.0070.07014.81
5.3.170.0130.04714.59
5.3.160.0100.05314.68
5.3.150.0130.04314.56
5.3.140.0030.08314.76
5.3.130.0100.05314.40
5.3.120.0130.04714.57
5.3.110.0200.05714.75
5.3.100.0170.04013.96
5.3.90.0130.05714.22
5.3.80.0170.06313.94
5.3.70.0100.06714.20
5.3.60.0070.05314.23
5.3.50.0100.05013.94
5.3.40.0170.06014.07
5.3.30.0100.06014.11
5.3.20.0100.06013.70
5.3.10.0100.05013.76
5.3.00.0100.06713.73
5.2.170.0130.03311.14
5.2.160.0070.06011.34
5.2.150.0100.04311.25
5.2.140.0100.05311.25
5.2.130.0070.05710.96
5.2.120.0000.05011.20
5.2.110.0070.06011.12
5.2.100.0100.05311.08
5.2.90.0100.04011.07
5.2.80.0030.06311.30
5.2.70.0070.06311.30
5.2.60.0100.03711.06
5.2.50.0100.05011.05
5.2.40.0070.05311.02
5.2.30.0000.05310.85
5.2.20.0070.04710.96
5.2.10.0070.04311.11
5.2.00.0100.04710.81
5.1.60.0100.03010.18
5.1.50.0070.04310.02
5.1.40.0170.03710.10
5.1.30.0070.04010.32
5.1.20.0070.03710.56
5.1.10.0070.05010.13
5.1.00.0070.03710.16
5.0.50.0000.0308.62
5.0.40.0130.0338.51
5.0.30.0100.0538.26
5.0.20.0030.0378.38
5.0.10.0070.0278.30
5.0.00.0100.0438.26
4.4.90.0030.0235.88
4.4.80.0070.0305.88
4.4.70.0070.0275.88
4.4.60.0070.0275.88
4.4.50.0030.0205.88
4.4.40.0070.0405.88
4.4.30.0030.0275.88
4.4.20.0000.0335.91
4.4.10.0100.0235.88
4.4.00.0070.0375.99
4.3.110.0070.0275.88
4.3.100.0070.0275.88
4.3.90.0130.0205.88
4.3.80.0000.0375.88
4.3.70.0030.0275.88
4.3.60.0070.0205.88
4.3.50.0100.0235.88
4.3.40.0000.0375.88
4.3.30.0030.0305.88
4.3.20.0000.0305.88
4.3.10.0230.0105.88
4.3.00.0130.0206.52

preferences:
48.19 ms | 401 KiB | 5 Q