3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?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).
Note: hhvm uses a JIT which only kicks in after a few runs. Since we run scripts only once, hhvm always runs slower.

VersionSystem time (s)User time (s)Memory (MiB)
7.3.10.0040.01216.58
7.3.00.0030.01016.59
7.2.130.0040.01116.68
7.2.120.0030.01516.82
7.2.110.0040.01116.92
7.2.100.0030.01016.66
7.2.90.0090.00616.83
7.2.80.0110.00416.84
7.2.70.0030.00716.93
7.2.60.0050.00716.57
7.2.50.0030.00916.89
7.2.40.0130.00316.93
7.2.30.0090.00616.78
7.2.20.0150.00016.42
7.2.10.0090.00616.61
7.2.00.0080.00517.84
7.1.250.0070.00715.69
7.1.200.0090.00615.80
7.1.100.0030.01017.88
7.1.70.0070.00316.75
7.1.60.0090.01519.82
7.1.50.0070.01016.98
7.1.00.0100.07022.40
7.0.200.0070.00316.61
7.0.140.0030.07722.15
7.0.60.0030.04019.83
7.0.50.0170.04017.86
7.0.40.0100.08720.27
7.0.30.0470.08020.07
7.0.20.0170.08720.33
7.0.10.0100.06320.06
7.0.00.0100.08020.06
5.6.280.0030.07321.03
5.6.210.0030.04020.78
5.6.200.0100.05318.19
5.6.190.0070.09020.48
5.6.180.0230.03720.58
5.6.170.0230.04020.50
5.6.160.0000.05020.50
5.6.150.0130.03718.14
5.6.140.0130.06318.18
5.6.130.0030.04018.14
5.6.120.0070.06321.01
5.6.110.0070.08021.04
5.6.100.0100.04021.01
5.6.90.0170.07721.11
5.6.80.0130.06720.36
5.6.70.4570.03720.36
5.5.350.0100.03320.40
5.5.340.0030.07017.98
5.5.330.0070.07320.35
5.5.320.0270.04320.25
5.5.310.0270.05320.34
5.5.300.0030.05717.98
5.5.290.0070.08317.98
5.5.280.0070.08320.78
5.5.270.0130.05720.85
5.5.260.0130.07720.80
5.5.250.0100.08720.50
5.5.240.0130.05320.20
5.4.450.0070.06019.62
5.4.440.0870.05319.58
5.4.430.0130.05019.42
5.4.420.0070.08019.62
5.4.410.0230.06719.32
5.4.400.1470.00018.77
5.4.390.1330.00018.79
5.4.380.0300.05018.55
5.4.370.0030.06318.49
5.4.360.0170.05318.84
5.4.350.0200.05018.63
5.4.340.0270.04318.71
5.4.320.0070.03612.52
5.4.310.0060.03812.52
5.4.300.0050.03812.52
5.4.290.0080.03712.52
5.4.280.0090.03512.42
5.4.270.0170.04719.02
5.4.260.0130.07718.65
5.4.250.0100.07319.02
5.4.240.0130.05318.93
5.4.230.0070.05318.75
5.4.220.0170.07019.04
5.4.210.0170.05018.94
5.4.200.0100.07018.94
5.4.190.0170.06719.09
5.4.180.0100.05318.73
5.4.170.0230.05018.95
5.4.160.0170.04318.93
5.4.150.0070.08018.75
5.4.140.0030.05716.65
5.4.130.0170.05016.52
5.4.120.0130.06316.50
5.4.110.0170.06316.54
5.4.100.0370.03316.38
5.4.90.0100.04316.43
5.4.80.0030.05716.60
5.4.70.0000.06316.44
5.4.60.0130.06316.63
5.4.50.0070.05316.32
5.4.40.0070.06016.49
5.4.30.0070.06316.56
5.4.20.0100.07016.48
5.4.10.0100.04716.49
5.4.00.0070.06716.01
5.3.290.0070.03812.80
5.3.280.0070.05714.61
5.3.270.0100.07314.62
5.3.260.0100.05314.60
5.3.250.0070.05714.61
5.3.240.0070.05714.60
5.3.230.0100.06014.80
5.3.220.0130.04314.50
5.3.210.0230.06014.66
5.3.200.0200.06014.58
5.3.190.0030.06014.68
5.3.180.0030.07314.75
5.3.170.0170.03714.56
5.3.160.0100.06714.81
5.3.150.0000.06014.61
5.3.140.0000.06014.57
5.3.130.0100.05014.70
5.3.120.0100.05314.66
5.3.110.0070.05314.68
5.3.100.0200.05714.14
5.3.90.0170.04714.12
5.3.80.0100.06714.21
5.3.70.0000.05714.21
5.3.60.0070.05714.00
5.3.50.0070.06313.88
5.3.40.0000.06313.99
5.3.30.0100.06713.89
5.3.20.0130.04313.79
5.3.10.0070.05313.73
5.3.00.0200.05713.73
5.2.170.0170.04711.24
5.2.160.0030.04311.25
5.2.150.0070.04311.35
5.2.140.0030.04311.34
5.2.130.0000.05311.03
5.2.120.0070.05311.32
5.2.110.0030.04711.08
5.2.100.0130.03311.03
5.2.90.0030.04711.28
5.2.80.0000.05011.29
5.2.70.0000.04711.18
5.2.60.0130.05011.03
5.2.50.0130.03311.12
5.2.40.0030.05311.10
5.2.30.0070.04710.97
5.2.20.0030.05311.07
5.2.10.0000.04310.97
5.2.00.0070.03710.91
5.1.60.0030.05010.11
5.1.50.0070.03310.00
5.1.40.0000.05310.01
5.1.30.0070.03310.52
5.1.20.0070.05010.39
5.1.10.0030.03310.07
5.1.00.0100.03310.25
5.0.50.0030.0408.64
5.0.40.0030.0308.48
5.0.30.0000.0578.45
5.0.20.0030.0338.14
5.0.10.0030.0408.27
5.0.00.0030.0538.39
4.4.90.0070.0205.85
4.4.80.0070.0275.83
4.4.70.0000.0235.90
4.4.60.0030.0275.85
4.4.50.0070.0175.83
4.4.40.0030.0375.98
4.4.30.0030.0275.86
4.4.20.0070.0235.88
4.4.10.0030.0235.91
4.4.00.0030.0335.85
4.3.110.0000.0275.78
4.3.100.0030.0235.89
4.3.90.0030.0205.88
4.3.80.0100.0335.88
4.3.70.0070.0275.88
4.3.60.0000.0235.88
4.3.50.0000.0305.88
4.3.40.0000.0435.88
4.3.30.0000.0235.88
4.3.20.0030.0235.88
4.3.10.0000.0305.88
4.3.00.0130.0236.54