3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Student { private $classes; public function __construct($classes) { $this->classes = $classes; } public function getClasses() { return $this->classes; } public function combineClasses(Student $otherStudent) { $allClasses = array_unique(array_merge($this->classes, $otherStudent->classes)); $this->classes = $allClasses; $otherStudent->classes = $allClasses; } } $mary = new Student(['CompSci2001', 'CompSci2002']); $john = new Student(['CompSci2002', 'CompSci2003']); $mary->combineClasses($john); var_dump($mary->getClasses()); var_dump($john->getClasses());
based on 3nLfb

Here you find the average performance (time & memory) of each version. A greyed 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.1.70.0040.00417.21
7.1.60.0070.00717.09
7.1.00.0070.07322.36
7.0.200.0050.00316.49
7.0.130.0200.06320.17
7.0.120.0070.06022.07
7.0.110.0130.05322.04
7.0.100.0170.07022.12
7.0.90.0100.05721.98
7.0.80.0030.06022.14
7.0.70.0100.05322.10
7.0.60.0100.05722.03
7.0.50.0100.05722.08
7.0.40.0200.05322.03
7.0.30.0100.06022.02
7.0.20.0070.07722.19
7.0.10.0070.06321.97
7.0.00.0200.04722.14
5.6.280.0100.05321.00
5.6.270.0000.06320.94
5.6.260.0130.05320.79
5.6.250.0000.06321.04
5.6.240.0100.05721.04
5.6.230.0170.05721.02
5.6.220.0100.05320.98
5.6.210.0100.05320.98
5.6.200.0130.06721.05
5.6.190.0130.06020.84
5.6.180.0130.07020.91
5.6.170.0030.06321.01
5.6.160.0170.05020.84
5.6.150.0130.05321.06
5.6.140.0070.06320.83
5.6.130.0070.05721.00
5.6.120.0100.05721.01
5.6.110.0130.06320.83
5.6.100.0070.07320.79
5.6.90.0130.05720.99
5.6.80.0100.05320.43
5.6.70.0130.05320.35
5.6.60.0170.04720.41
5.6.50.0030.05720.22
5.6.40.0100.07320.20
5.6.30.0100.05320.45
5.6.20.0130.05020.21
5.6.10.0170.04720.18
5.6.00.0130.05720.44