3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Menu { private $menus = []; private $name; public function __construct($name) { $this->name = $name; } public function addMenu(self $menu) { $this->menus[] = $menu; } public function getMenus() { return $this->menus; } public function __toString() { return $this->name; } } class SubMenu extends Menu {} $menu1 = new Menu('Top Level Menu'); $menu1->addMenu(new Menu('Child Menu')); $menu1->addMenu(new SubMenu('Sub Menu')); foreach ($menu1->getMenus() as $menu) { echo "{$menu}<br />"; }
based on WhXTn

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.00.0060.00619.21
7.1.100.0080.00317.84
7.1.70.0030.00616.76
7.1.60.0060.01919.50
7.1.50.0100.01316.96
7.1.00.0070.09322.27
7.0.200.0080.00016.80
7.0.140.0030.07322.10
7.0.60.0070.03719.87
7.0.50.0070.05717.89
7.0.40.0100.03720.13
7.0.30.0400.07320.07
7.0.20.0300.07720.23
7.0.10.0030.04320.07
7.0.00.0130.06320.16
5.6.280.0070.08720.92
5.6.210.0130.05320.77
5.6.200.0130.05018.16
5.6.190.0070.08720.50
5.6.180.0400.07320.43
5.6.170.0400.06720.45
5.6.160.0070.04720.47
5.6.150.0030.04318.17
5.6.140.0030.03718.27
5.6.130.0000.04318.20
5.6.120.0100.08021.05
5.6.110.0100.08321.01
5.6.100.0130.07721.03
5.6.90.0070.08321.01
5.6.80.0000.04320.44
5.5.350.0200.05320.41
5.5.340.0100.07718.09
5.5.330.0000.04720.19
5.5.320.0200.06020.21
5.5.310.0230.05720.27
5.5.300.0100.07318.03
5.5.290.0030.04717.99
5.5.280.0230.06320.88
5.5.270.0100.07320.76
5.5.260.0130.07720.82
5.5.250.0000.05320.76
5.5.240.0070.07320.16
5.4.450.0670.05319.20
5.4.440.0470.06019.58
5.4.430.0030.06319.61
5.4.420.0370.05019.48
5.4.410.1100.05319.21
5.4.400.0200.05018.50
5.4.390.0130.07018.57
5.4.380.0170.05718.78
5.4.370.0130.06018.46
5.4.360.0130.06018.70
5.4.350.0200.06718.71
5.4.340.0270.05018.72
5.4.320.0200.06318.71
5.4.310.0170.05718.76
5.4.300.0230.05018.43
5.4.290.0100.06018.55
5.4.280.0270.04318.48
5.4.270.0200.05018.49
5.4.260.0300.04318.68
5.4.250.0130.06018.70
5.4.240.0200.06318.54
5.4.230.0130.05718.75
5.4.220.0200.05318.70
5.4.210.0370.04018.49
5.4.200.0200.04716.61
5.4.190.0170.05718.79
5.4.180.0130.06018.53
5.4.170.0170.05718.71
5.4.160.0230.05318.80
5.4.150.0370.04018.51
5.4.140.0230.05316.26
5.4.130.0200.05716.19
5.4.120.0200.05716.23
5.4.110.0230.05016.43
5.4.100.0130.05716.19
5.4.90.0170.05316.32
5.4.80.0200.04716.34
5.4.70.0170.05316.19
5.4.60.0270.04316.23
5.4.50.0230.04716.30
5.4.40.0200.05716.28
5.4.30.0230.04716.21
5.4.20.0130.05716.21
5.4.10.0300.06016.23
5.4.00.0200.06015.76
5.3.290.0270.05714.65
5.3.280.0170.06014.80
5.3.270.0200.05314.72
5.3.260.0200.06014.64
5.3.250.0230.04714.78
5.3.240.0270.04714.80
5.3.230.0130.06014.73
5.3.220.0200.05314.71
5.3.210.0130.05714.75
5.3.200.0170.06014.62
5.3.190.0200.05014.61
5.3.180.0230.04714.69
5.3.170.0200.05314.60
5.3.160.0070.06314.63
5.3.150.0170.05314.55
5.3.140.0230.04314.66
5.3.130.0270.05714.56
5.3.120.0130.05714.67
5.3.110.0130.06014.68
5.3.100.0130.05314.07
5.3.90.0170.05014.00
5.3.80.0100.05714.20
5.3.70.0200.04714.05
5.3.60.0200.05314.12
5.3.50.0300.04014.13
5.3.40.0170.05313.98
5.3.30.0270.06314.06
5.3.20.0330.05713.89
5.3.10.0170.05313.77
5.3.00.0330.03713.71
5.2.170.0030.05311.18
5.2.160.0200.04011.19
5.2.150.0200.04311.25
5.2.140.0170.04011.11
5.2.130.0170.03711.20
5.2.120.0100.04311.20
5.2.110.0170.03711.16
5.2.100.0130.04011.09
5.2.90.0100.04311.13
5.2.80.0230.05311.19
5.2.70.0200.03711.07
5.2.60.0130.04311.17
5.2.50.0170.03711.00
5.2.40.0170.03711.02
5.2.30.0100.05310.98
5.2.20.0130.04311.06
5.2.10.0100.04311.05
5.2.00.0170.03710.91
5.1.60.0130.04010.05
5.1.50.0130.03310.07
5.1.40.0130.03010.04
5.1.30.0130.03310.38
5.1.20.0200.02710.53
5.1.10.0070.04010.25
5.1.00.0130.03710.13
5.0.50.0000.0378.54
5.0.40.0000.0408.58
5.0.30.0030.0508.21
5.0.20.0070.0278.18
5.0.10.0130.0238.34
5.0.00.0030.0478.14
4.4.90.0130.0235.89
4.4.80.0030.0235.90
4.4.70.0070.0235.88
4.4.60.0070.0236.00
4.4.50.0100.0205.88
4.4.40.0130.0305.90
4.4.30.0070.0235.88
4.4.20.0030.0305.95
4.4.10.0030.0235.93
4.4.00.0070.0375.90
4.3.110.0130.0205.80
4.3.100.0100.0205.93
4.3.90.0070.0235.82
4.3.80.0030.0435.78
4.3.70.0030.0235.80
4.3.60.0100.0205.76
4.3.50.0030.0235.78
4.3.40.0170.0235.79
4.3.30.0000.0274.66
4.3.20.0070.0204.56
4.3.10.0070.0204.52
4.3.00.0130.0307.12