3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?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 $stores; 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 = implode("<br />", $items); 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 />"; echo $test->stores //print_r($test -> unFunction($test->stores)); //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.2.60.0090.00616.89
7.2.00.0040.00819.23
7.1.200.0120.00315.87
7.1.100.0000.01617.95
7.1.70.0060.00316.90
7.1.60.0140.01019.82
7.1.50.0110.00416.96
7.1.00.0030.07722.57
7.0.200.0030.00716.82
7.0.140.0030.07322.17
7.0.60.0000.05320.06
7.0.50.0070.05318.01
7.0.40.0030.08320.11
7.0.30.0200.03720.13
7.0.20.0230.06020.17
7.0.10.0170.04020.07
7.0.00.0100.08720.23
5.6.280.0000.07721.16
5.6.210.0030.05320.76
5.6.200.0070.08018.13
5.6.190.0070.04720.41
5.6.180.0170.04720.46
5.6.170.0200.06020.52
5.6.160.0070.03720.48
5.6.150.0130.04018.21
5.6.140.0130.05718.17
5.6.130.0070.04018.15
5.6.120.0030.04321.03
5.6.110.0230.07020.99
5.6.100.0130.08721.01
5.6.90.0070.08321.04
5.6.80.0070.04020.39
5.5.350.0330.07020.47
5.5.340.0030.04017.93
5.5.330.0170.04720.43
5.5.320.0300.05320.36
5.5.310.0170.05020.32
5.5.300.0300.05318.08
5.5.290.0100.06717.98
5.5.280.0100.05020.76
5.5.270.0130.06720.77
5.5.260.0170.04020.98
5.5.250.0070.07020.79
5.5.240.0070.07720.27
5.4.450.0700.04719.20
5.4.440.0370.04319.27
5.4.430.0970.03019.55
5.4.420.0900.04019.47
5.4.410.0270.04319.42
5.4.400.0600.03719.15
5.4.390.0570.03718.84
5.4.380.0400.06018.59
5.4.370.0370.06018.54
5.4.360.0200.06318.77
5.4.350.0330.05718.55
5.4.340.0300.05718.48
5.4.320.0060.04212.52
5.4.310.0100.04312.52
5.4.300.0090.03512.52
5.4.290.0050.04112.51
5.4.280.0050.04512.41
5.4.270.0100.05718.81
5.4.260.0130.06718.99
5.4.250.0100.06018.95
5.4.240.0130.05018.74
5.4.230.0170.05719.03
5.4.220.0100.07718.83
5.4.210.0070.05318.76
5.4.200.0130.07018.99
5.4.190.0170.06318.98
5.4.180.0070.05718.89
5.4.170.0130.05018.76
5.4.160.0130.05718.78
5.4.150.0130.06318.97
5.4.140.0200.06316.44
5.4.130.0170.05716.64
5.4.120.0100.05016.36
5.4.110.0030.05316.38
5.4.100.0100.05016.56
5.4.90.0030.06016.57
5.4.80.0100.06016.45
5.4.70.0130.07316.55
5.4.60.0000.05716.48
5.4.50.0230.05316.36
5.4.40.0130.04316.51
5.4.30.0070.06016.39
5.4.20.0130.05716.39
5.4.10.0170.06716.36
5.4.00.0130.05315.98
5.3.290.0060.04012.80
5.3.280.0170.05714.69
5.3.270.0100.07314.46
5.3.260.0270.05714.79
5.3.250.0000.06314.72
5.3.240.0100.05014.81
5.3.230.0130.04714.80
5.3.220.0030.06714.43
5.3.210.0070.05714.58
5.3.200.0100.07014.55
5.3.190.0100.05014.81
5.3.180.0070.05314.42
5.3.170.0070.06014.61
5.3.160.0130.06314.66
5.3.150.0170.05014.42
5.3.140.0130.04714.65
5.3.130.0070.05714.75
5.3.120.0030.06714.66
5.3.110.0100.05014.63
5.3.100.0100.04714.15
5.3.90.0200.06014.21
5.3.80.0170.04714.26
5.3.70.0100.05714.01
5.3.60.0100.07014.00
5.3.50.0130.04314.05
5.3.40.0130.04314.00
5.3.30.0070.06013.95
5.3.20.0130.05013.73
5.3.10.0130.06313.86
5.3.00.0130.06313.72
5.2.170.0030.04311.25
5.2.160.0030.05011.07
5.2.150.0070.04711.07
5.2.140.0070.04311.16
5.2.130.0000.05711.20
5.2.120.0000.04311.20
5.2.110.0100.04311.20
5.2.100.0070.04011.34
5.2.90.0130.03311.20
5.2.80.0100.05011.33
5.2.70.0100.04011.29
5.2.60.0000.04311.07
5.2.50.0070.04311.27
5.2.40.0030.04011.18
5.2.30.0030.04011.08
5.2.20.0030.04710.95
5.2.10.0170.03010.88
5.2.00.0000.05310.81
5.1.60.0030.03310.18
5.1.50.0070.03710.12
5.1.40.0000.03710.16
5.1.30.0030.04710.35
5.1.20.0030.05310.55
5.1.10.0070.03310.18
5.1.00.0100.03310.06
5.0.50.0070.0238.67
5.0.40.0070.0278.36
5.0.30.0030.0438.21
5.0.20.0070.0278.29
5.0.10.0100.0338.17
5.0.00.0000.0538.29
4.4.90.0000.0335.84
4.4.80.0030.0305.85
4.4.70.0000.0275.85
4.4.60.0000.0235.84
4.4.50.0000.0235.86
4.4.40.0030.0335.86
4.4.30.0100.0235.82
4.4.20.0030.0235.92
4.4.10.0070.0275.89
4.4.00.0030.0335.85
4.3.110.0070.0175.79
4.3.100.0000.0235.77
4.3.90.0000.0275.82
4.3.80.0000.0335.77
4.3.70.0030.0305.77
4.3.60.0030.0205.77
4.3.50.0000.0235.77
4.3.40.0100.0275.78
4.3.30.0070.0235.77
4.3.20.0000.0235.77
4.3.10.0000.0275.77
4.3.00.0000.02015.57