3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php interface Logger { public function log(string $msg); } class Application { private $logger; public function getLogger(): Logger { return $this->logger; } public function setLogger(Logger $logger) { $this->logger = $logger; } } $app = new Application; $app->setLogger(new class implements Logger { public function log(string $msg) { echo $msg; } }); var_dump($app->getLogger()); ?>
based on sD6DL

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.0080.00416.65
7.2.00.0150.00319.57
7.1.200.0040.01115.56
7.1.100.0040.00717.71
7.1.70.0070.00017.07
7.1.60.0100.01419.50
7.1.50.0070.01316.52
7.1.00.0000.08022.32
7.0.200.0200.01014.57
7.0.100.0070.08319.96
7.0.90.0100.06319.91
7.0.80.0100.08319.87
7.0.70.0070.06019.88
7.0.60.0100.08019.92
7.0.50.0000.06020.17
7.0.40.0070.07020.09
7.0.30.0000.05320.06
7.0.20.0030.04319.95
7.0.10.0030.04320.14
7.0.00.0030.06020.03
5.6.280.0070.03021.12
5.6.250.0070.08020.62
5.6.240.0070.08720.68
5.6.230.0030.06020.55
5.6.220.0170.07320.54
5.6.210.0130.06720.41
5.6.200.0200.06720.96
5.6.190.0130.08021.05
5.6.180.0170.06721.10
5.6.170.0030.04321.00
5.6.160.0100.03720.98
5.6.150.0030.04021.04
5.6.140.0100.06720.89
5.6.130.0030.08020.89
5.6.120.0000.07021.07
5.6.110.0070.04021.04
5.6.100.0030.08321.06
5.6.90.0000.04720.99
5.6.80.0030.05320.37
5.6.70.0030.03720.44
5.6.60.0030.05320.30
5.6.50.0000.05020.29
5.6.40.0070.03320.32
5.6.30.0100.04720.37
5.6.20.0030.04720.35
5.6.10.0030.07720.39
5.6.00.0070.03720.42
5.5.380.0170.07320.31
5.5.370.0100.07320.34
5.5.360.0070.08720.29
5.5.350.0070.05320.36
5.5.340.0030.07720.86
5.5.330.0030.09020.78
5.5.320.0070.06020.89
5.5.310.0070.05020.72
5.5.300.0070.03720.79
5.5.290.0070.08720.80
5.5.280.0070.04320.76
5.5.270.0030.06320.73
5.5.260.0000.07720.88
5.5.250.0100.06720.70
5.5.240.0000.06320.18
5.5.230.0030.04020.20
5.5.220.0030.03720.18
5.5.210.0130.05020.27
5.5.200.0070.04020.20
5.5.190.0070.04319.91
5.5.180.0030.06720.20
5.5.160.0000.03720.23
5.5.150.0030.03320.14
5.5.140.0070.03720.18
5.5.130.0030.04020.09
5.5.120.0070.03720.04
5.5.110.0030.05720.13
5.5.100.0130.03020.00
5.5.90.0000.07020.03
5.5.80.0030.03320.05
5.5.70.0070.08020.02
5.5.60.0070.07719.89
5.5.50.0170.07020.06
5.5.40.0130.07019.92
5.5.30.0070.08020.11
5.5.20.0070.07720.02
5.5.10.0030.08319.93
5.5.00.0100.07720.06
5.4.450.0070.05019.51
5.4.440.0030.07719.37
5.4.430.0070.03719.46
5.4.420.0100.05719.41
5.4.410.0000.04319.34
5.4.400.0100.06019.14
5.4.390.0030.04019.04
5.4.380.0000.04018.85
5.4.370.0070.03719.10
5.4.360.0100.03019.16
5.4.350.0000.04019.21
5.4.340.0100.05319.24
5.4.320.0030.06019.14
5.4.310.0000.04018.88
5.4.300.0030.03719.18
5.4.290.0030.03719.14
5.4.280.0030.03719.04
5.4.270.0000.03719.04
5.4.260.0070.03319.03
5.4.250.0030.03319.20
5.4.240.0030.03719.14
5.4.230.0100.06318.96
5.4.220.0070.07318.89
5.4.210.0030.05018.85
5.4.200.0070.08018.94
5.4.190.0130.05719.12
5.4.180.0130.06319.04
5.4.170.0130.07019.11
5.4.160.0100.04319.21
5.4.150.0130.06718.85
5.4.140.0100.06316.47
5.4.130.0070.06016.46
5.4.120.0100.06716.45
5.4.110.0030.07716.52
5.4.100.0070.04016.38
5.4.90.0000.07316.40
5.4.80.0000.05716.46
5.4.70.0070.05016.43
5.4.60.0070.07016.32
5.4.50.0030.04016.41
5.4.40.0100.07316.48
5.4.30.0030.06016.47
5.4.20.0000.08716.46
5.4.10.0000.07716.49
5.4.00.0000.05715.58