3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php /** * An example of duck typing in PHP */ interface CanFly { public function fly(); } interface CanSwim { public function swim(); } class Bird { public function info() { echo "I am a {$this->name}\n"; echo "I am an bird\n"; } } /** * some implementations of birds */ class Dove extends Bird implements CanFly { var $name = "Dove"; public function fly() { echo "I fly\n"; } } class Penguin extends Bird implements CanSwim { var $name = "Penguin"; public function swim() { echo "I swim\n"; } } class Duck extends Bird implements CanFly, CanSwim { var $name = "Duck"; public function fly() { echo "I fly\n"; } public function swim() { echo "I swim\n"; } } /** * a simple function to describe a bird */ function describe($bird) { if ($bird instanceof Bird) { $bird->info(); if ($bird instanceof CanFly) { $bird->fly(); } if ($bird instanceof CanSwim) { $bird->swim(); } } else { die("This is not a bird. I cannot describe it."); } } echo describe("Duck");

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.0060.00616.46
7.3.00.0080.00016.57
7.2.130.0000.01116.91
7.2.120.0060.00616.92
7.2.110.0090.00316.93
7.2.100.0120.00016.91
7.2.90.0000.01416.92
7.2.80.0030.01016.76
7.2.70.0070.00716.96
7.2.60.0030.00916.66
7.2.50.0030.00916.60
7.2.40.0120.00316.86
7.2.30.0000.01316.82
7.2.20.0080.00817.00
7.2.10.0090.00616.90
7.2.00.0100.00418.01
7.1.250.0000.00815.79
7.1.100.0070.00718.12
7.1.70.0130.00715.24
7.1.60.0270.00733.38
7.1.50.0200.01333.00
7.1.40.1400.02332.52
7.1.30.1400.01732.72
7.1.20.1430.01332.47
7.1.10.1570.01014.78
7.1.00.1370.00714.89
7.0.200.0000.01715.09
7.0.190.1030.01315.04
7.0.180.1430.01014.50
7.0.170.1300.00014.37
7.0.160.1230.01014.64
7.0.150.0970.01314.37
7.0.140.1570.01014.56
7.0.130.1170.00314.63
7.0.120.1070.01014.74
7.0.110.2300.01014.52
7.0.100.1070.01014.38
7.0.90.1570.01314.39
7.0.80.1630.01714.46
7.0.70.1730.01314.51
7.0.60.1670.01314.13
7.0.50.1600.01014.56
7.0.40.1600.01314.60
7.0.30.0830.01014.53
7.0.20.1530.00714.61
7.0.10.0000.01714.59
7.0.00.0070.00714.65
hhvm-3.15.40.0570.21085.37
5.6.300.0100.06320.91
5.6.290.0130.08020.60
5.6.280.0100.06320.77
5.6.270.0200.05320.78
5.6.260.0130.05720.75
5.6.250.0200.06320.88
5.6.240.0170.07020.79
5.6.230.0200.07320.79
5.6.220.0300.06020.73
5.6.210.0130.07320.96
5.6.200.0100.07320.78
5.6.190.0170.06320.90
5.6.180.0200.07320.85
5.6.170.0170.06720.77
5.6.160.0170.05721.01
5.6.150.0070.10020.71
5.6.140.0200.08320.90
5.6.130.0130.08720.91
5.6.120.0130.07320.74
5.6.110.0170.08720.92
5.6.100.0200.08320.94
5.6.90.0170.08320.72
5.6.80.0070.08720.23
5.6.70.0130.07320.08
5.6.60.0270.06320.30
5.6.50.0170.07320.22
5.6.40.0200.07020.32
5.6.30.0230.06720.34
5.6.20.0170.07320.06
5.6.10.0170.06320.12
5.6.00.0270.05020.29