3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php abstract class T { static public $instanses; final private function __construct(){ } public static function getInstance() { var_dump(static::$instanses); if (!(static::$instanses instanceof static)) { static::$instanses = new static; } var_dump(static::$instanses); return static::$instanses; } } class A extends T { static public $instanses; } class B extends A { static public $instanses; } $t = A::getInstance(); var_dump($t); $t1 = B::getInstance(); var_dump($t1); new B(); ?>
based on ni8iO

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.80.0040.00416.80
7.2.60.0030.01016.64
7.2.00.0030.01019.63
7.1.200.0000.01415.51
7.1.100.0090.00618.33
7.1.70.0000.00717.18
7.1.60.0070.01720.03
7.1.50.0070.00716.89
7.1.00.0030.07722.54
7.0.200.0070.00016.79
7.0.60.0100.08319.92
7.0.50.0100.06017.86
7.0.40.0100.04020.11
7.0.30.0270.08020.17
7.0.20.0230.06320.09
7.0.10.0030.04720.08
7.0.00.0030.08720.30
5.6.280.0030.07321.02
5.6.210.0100.08720.72
5.6.200.0130.06018.22
5.6.190.0130.03320.57
5.6.180.0230.05320.41
5.6.170.0300.07020.43
5.6.160.0100.07020.46
5.6.150.0030.04018.24
5.6.140.0100.05318.14
5.6.130.0100.07018.24
5.6.120.0100.08321.15
5.6.110.0070.03721.05
5.6.100.0030.08721.09
5.6.90.0070.03720.97
5.6.80.0100.07720.51
5.6.70.4130.03720.28
5.5.350.0270.08020.45
5.5.340.0130.07317.99
5.5.330.0100.07020.29
5.5.320.0300.06720.34
5.5.310.0370.07720.21
5.5.300.0130.05017.97
5.5.290.0000.05317.96
5.5.280.0100.03320.66
5.5.270.0270.07020.77
5.5.260.0030.08320.90
5.5.250.0030.05720.66
5.5.240.4130.03320.27
5.4.450.0870.05719.55
5.4.440.0830.06019.70
5.4.430.0970.04319.70
5.4.420.0900.05319.16
5.4.410.0900.05319.25
5.4.400.0900.05719.15
5.4.390.0970.04319.39
5.4.380.0930.05019.23
5.4.370.0870.05318.84
5.4.360.0930.05018.88
5.4.350.0830.05319.23
5.4.340.0830.06719.25
5.4.320.0830.05319.06
5.4.310.0370.05719.11
5.4.300.0170.05019.25
5.4.290.0270.03719.14
5.4.280.0770.04719.28
5.4.270.0900.05018.97
5.4.260.0770.05319.37
5.4.250.0800.05019.12
5.4.240.0800.06019.21
5.4.230.0770.05718.97
5.4.220.1130.04718.97
5.4.210.0770.05719.30
5.4.200.1030.05316.76
5.4.190.0930.05019.07
5.4.180.0870.05719.08
5.4.170.1030.05019.29
5.4.160.0830.05319.01
5.4.150.0930.05718.96
5.4.140.0900.05016.51
5.4.130.0830.05716.40
5.4.120.0830.05716.55
5.4.110.0930.04316.54
5.4.100.1030.05716.42
5.4.90.0770.06316.56
5.4.80.1030.04016.30
5.4.70.0800.05716.38
5.4.60.0130.06716.54
5.4.50.0070.03016.51
5.4.40.0270.07016.51
5.4.30.0370.06016.38
5.4.20.0300.06716.42
5.3.290.0930.03714.81
5.3.280.0600.04714.76
5.3.270.0300.04714.52
5.3.260.0800.05014.53
5.3.250.0900.02714.51
5.3.240.0130.05014.51
5.3.230.0830.05314.65
5.3.220.0700.04314.74
5.3.210.0700.04014.47
5.3.200.0270.03314.58
5.3.190.1230.03314.54
5.3.180.0230.04014.64
5.3.170.1230.03014.54