3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php trait Singleton { public static function getInstance(){ static $counter = 0; static $instance = null; if (!isset($instance)) { echo 'new instance has been set'; $instance = new static(); } $counter++; echo "$counter\n"; return $instance; } } abstract class Abudabia { use Singleton; } class a1 extends Abudabia { public function set() { return 'allah ahbar'; } } class a2 extends Abudabia { public function get() { return 'algazira'; } } $a = a1::getInstance(); $b = a2::getInstance(); $a = a1::getInstance(); $b = a2::getInstance(); $a = a1::getInstance(); $b = a2::getInstance(); var_dump($a,$b);
based on JYXfU

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.0140.00016.80
7.2.00.0090.00519.55
7.1.200.0060.00915.83
7.1.100.0040.00718.13
7.1.70.0000.00717.07
7.1.60.0090.01219.32
7.1.50.0130.00316.91
7.1.00.0000.08022.48
7.0.200.0060.00316.52
7.0.140.0030.07321.97
7.0.60.0000.04319.88
7.0.50.0100.07717.90
7.0.40.0030.07020.30
7.0.30.0300.07720.12
7.0.20.0170.04020.23
7.0.10.0070.08720.30
7.0.00.0030.04320.08
5.6.280.0030.07320.97
5.6.210.0100.07720.51
5.6.200.0000.08318.19
5.6.190.0070.08720.41
5.6.180.0200.04720.50
5.6.170.0300.07020.52
5.6.160.0070.05320.51
5.6.150.0070.06318.29
5.6.140.0130.04718.14
5.6.130.0100.04318.28
5.6.120.0000.04721.14
5.6.110.0170.07721.01
5.6.100.0100.08020.98
5.6.90.0100.07321.11
5.6.80.0070.05720.39
5.6.70.4330.03320.52
5.5.350.0130.07720.47
5.5.340.0130.03018.04
5.5.330.0130.04720.27
5.5.320.0130.07320.32
5.5.310.0370.07020.35
5.5.300.0070.08317.95
5.5.290.0100.06317.98
5.5.280.0100.07320.81
5.5.270.0170.07720.80
5.5.260.0070.08320.88
5.5.250.0030.08320.71
5.5.240.0170.03720.29
5.4.450.0300.04319.27
5.4.440.0170.04719.64
5.4.430.0330.05019.54
5.4.420.0670.00019.53
5.4.410.0630.00019.57
5.4.400.0630.00019.16
5.4.390.0830.00019.02
5.4.380.0670.00019.13
5.4.370.0670.00019.07
5.4.360.0600.00019.02
5.4.350.0630.00019.26
5.4.340.0080.03312.02
5.4.320.0120.03812.51
5.4.310.0060.03812.51
5.4.300.0070.04012.51
5.4.290.0090.03712.50
5.4.280.0070.03712.40
5.4.270.0090.03712.40
5.4.260.0060.03712.40
5.4.250.0070.03612.40
5.4.240.0090.03312.40
5.4.230.0070.03612.39
5.4.220.0070.03412.39
5.4.210.0060.03412.39
5.4.200.0050.03712.39
5.4.190.0050.03812.39
5.4.180.0070.03812.39
5.4.170.0110.03512.40
5.4.160.0080.03512.39
5.4.150.0050.03612.39
5.4.140.0060.03612.08
5.4.130.0060.03512.06
5.4.120.0100.04112.02
5.4.110.0050.03512.02
5.4.100.0050.03612.02
5.4.90.0060.03712.02
5.4.80.0060.03712.02
5.4.70.0070.05112.01
5.4.60.0080.03412.01
5.4.50.0070.04112.02
5.4.40.0070.03812.00
5.4.30.0080.03412.00
5.4.20.0100.03112.00
5.4.10.0060.03411.99
5.4.00.0060.03411.48
5.3.290.0070.03812.80
5.3.280.0110.03312.71
5.3.270.0080.03712.73
5.3.260.0060.03812.71
5.3.250.0080.03612.71
5.3.240.0080.03612.71
5.3.230.0090.03412.71
5.3.220.0060.03612.68
5.3.210.0110.04012.68
5.3.200.0100.04712.68
5.3.190.0110.03312.68
5.3.180.0100.04712.67
5.3.170.0040.03712.67
5.3.160.0050.03612.67
5.3.150.0100.03212.68
5.3.140.0100.03212.66
5.3.130.0050.03812.66
5.3.120.0110.03312.66
5.3.110.0090.03412.66
5.3.100.0070.03912.12
5.3.90.0080.04512.08
5.3.80.0090.04012.07
5.3.70.0060.03612.07
5.3.60.0040.04012.06
5.3.50.0050.04212.00
5.3.40.0080.03412.00
5.3.30.0090.04511.95
5.3.20.0080.03311.73
5.3.10.0020.03811.70
5.3.00.0080.03511.68
5.2.170.0040.0319.18
5.2.160.0030.0319.18
5.2.150.0050.0359.18
5.2.140.0070.0409.18
5.2.130.0100.0409.14
5.2.120.0050.0279.14
5.2.110.0050.0289.15
5.2.100.0170.0319.14
5.2.90.0050.0349.14
5.2.80.0060.0319.14
5.2.70.0090.0389.14
5.2.60.0090.0369.09
5.2.50.0070.0319.06
5.2.40.0050.0309.03
5.2.30.0080.0339.01
5.2.20.0070.0269.00
5.2.10.0060.0308.93
5.2.00.0040.0298.78
5.1.60.0060.0308.07
5.1.50.0030.0358.06
5.1.40.0050.0318.04
5.1.30.0060.0238.39
5.1.20.0030.0278.42
5.1.10.0050.0258.14
5.1.00.0050.0258.14
5.0.50.0030.0216.63
5.0.40.0040.0196.48
5.0.30.0020.0336.29
5.0.20.0050.0176.27
5.0.10.0030.0266.25
5.0.00.0040.0286.23
4.4.90.0030.0174.78
4.4.80.0060.0224.75
4.4.70.0030.0194.75
4.4.60.0030.0154.75
4.4.50.0020.0154.77
4.4.40.0040.0274.70
4.4.30.0050.0244.76
4.4.20.0020.0164.84
4.4.10.0040.0154.85
4.4.00.0040.0394.76
4.3.110.0020.0264.67
4.3.100.0040.0134.67
4.3.90.0050.0274.63
4.3.80.0040.0234.58
4.3.70.0010.0224.63
4.3.60.0040.0134.63
4.3.50.0030.0224.63
4.3.40.0070.0314.54
4.3.30.0040.0253.28
4.3.20.0040.0163.26
4.3.10.0010.0273.22
4.3.00.0000.01710.41