3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Singleton { private static $instance = null; final private function __construct() {} final private function __clone() {} final private function __sleep() {} private function __invoke() {} public static function getInstance() { if (!self::$instance) { self::$instance = new self; } return self::$instance; } } $oneInstance = Singleton::getInstance(); echo "Cloneable outside:", var_dump((new ReflectionClass('Singleton'))->isCloneable()); $cloner = function () { return clone $this; }; $secondInstance = $cloner->bindTo($oneInstance, 'Singleton')->__invoke(); var_dump($oneInstance, $secondInstance);

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.0080.00419.52
7.1.100.0100.01017.65
7.1.70.0000.00717.29
7.1.60.0100.01319.43
7.1.50.0040.01816.90
7.1.00.0000.05322.44
7.0.200.0000.01016.78
7.0.140.0000.07722.21
7.0.60.0130.07319.88
7.0.50.0100.07317.89
7.0.40.0100.06320.18
7.0.30.0330.04020.30
7.0.20.0270.07320.17
7.0.10.0300.04720.25
7.0.00.0070.08320.07
5.6.280.0030.07321.12
5.6.210.0030.08320.65
5.6.200.0100.06318.19
5.6.190.0000.05020.60
5.6.180.0100.04720.52
5.6.170.0330.07720.48
5.6.160.0030.09020.43
5.6.150.0130.04018.14
5.6.140.0100.04318.28
5.6.130.0030.04018.23
5.6.120.0030.05321.01
5.6.110.0100.03720.95
5.6.100.0030.04720.89
5.6.90.0130.07321.01
5.6.80.0070.08320.40
5.6.70.0200.04020.38
5.5.350.0000.07720.31
5.5.340.0030.07017.99
5.5.330.0070.04720.32
5.5.320.0330.07320.25
5.5.310.0330.06020.25
5.5.300.0130.06017.97
5.5.290.0100.06318.08
5.5.280.0130.07020.77
5.5.270.0030.04320.77
5.5.260.0170.07320.98
5.5.250.0100.03720.70
5.5.240.0070.07020.38
5.4.450.0630.05019.45
5.4.440.0970.05319.70
5.4.430.0800.05019.16
5.4.420.0830.04319.57
5.4.410.0870.05019.50
5.4.400.1400.06018.79
5.4.390.1070.04318.73
5.4.380.0130.06718.79
5.4.370.0100.05718.50
5.4.360.0170.04718.70
5.4.350.0060.03512.02
5.4.340.0080.03812.02
5.4.320.0060.03712.51
5.4.310.0060.03712.50
5.4.300.0080.04912.51
5.4.290.0050.03912.50
5.4.280.0080.04212.40
5.4.270.0050.03912.39
5.4.260.0070.05212.39
5.4.250.0020.04012.40
5.4.240.0070.06318.93
5.4.230.0130.05718.93
5.4.220.0070.05718.89
5.4.210.0130.05018.75
5.4.200.0200.05719.04
5.4.190.0100.05318.63
5.4.180.0130.05018.94
5.4.170.0170.07018.73
5.4.160.0130.05018.63
5.4.150.0100.06718.98
5.4.140.0070.05716.58
5.4.130.0070.05316.60
5.4.120.0070.06016.59
5.4.110.0000.05716.59
5.4.100.0130.04016.29
5.4.90.0100.07316.41
5.4.80.0170.04316.59
5.4.70.0070.04716.33
5.4.60.0070.05716.30
5.4.50.0130.05016.34
5.4.40.0100.05016.49
5.4.30.0000.08016.61
5.4.20.0030.05316.55
5.4.10.0130.06016.35
5.4.00.0100.05015.89
5.3.290.0040.05912.80
5.3.280.0070.05014.50
5.3.270.0030.06014.69
5.3.260.0100.05714.60
5.3.250.0130.05014.70
5.3.240.0130.05314.70
5.3.230.0100.05014.69
5.3.220.0130.05314.55
5.3.210.0070.05714.54
5.3.200.0170.04014.54
5.3.190.0100.04714.66
5.3.180.0100.07014.75
5.3.170.0100.06314.47
5.3.160.0100.06014.65
5.3.150.0130.05314.79
5.3.140.0030.06314.64
5.3.130.0100.07314.53
5.3.120.0200.06014.54
5.3.110.0170.05714.54
5.3.100.0100.06014.26
5.3.90.0030.05714.11
5.3.80.0030.06013.99
5.3.70.0070.05314.11
5.3.60.0030.06014.18
5.3.50.0130.05014.04
5.3.40.0170.04014.18
5.3.30.0030.06313.99
5.3.20.0100.04713.71
5.3.10.0070.06713.88
5.3.00.0100.05313.61
5.2.170.0100.04311.23
5.2.160.0070.04011.32
5.2.150.0070.04711.37
5.2.140.0100.04011.33
5.2.130.0030.04011.29
5.2.120.0030.04711.27
5.2.110.0100.03311.33
5.2.100.0030.04311.18
5.2.90.0070.04011.11
5.2.80.0030.04311.07
5.2.70.0030.04711.16
5.2.60.0170.03010.96
5.2.50.0130.03310.98
5.2.40.0170.02710.97
5.2.30.0030.04311.04
5.2.20.0070.04310.93
5.2.10.0030.05711.04
5.2.00.0070.05710.70
5.1.60.0030.04710.05
5.1.50.0070.04010.10
5.1.40.0070.0339.97
5.1.30.0070.04710.34
5.1.20.0000.05310.44
5.1.10.0070.03010.07
5.1.00.0000.03710.13
5.0.50.0030.0309.97
5.0.40.0030.0279.97
5.0.30.0030.0409.97
5.0.20.0070.0239.97
5.0.10.0030.0279.97
5.0.00.0070.0509.97
4.4.90.0070.0179.97
4.4.80.0000.0239.97
4.4.70.0070.0179.97
4.4.60.0000.0239.97
4.4.50.0100.0139.97
4.4.40.0070.0439.97
4.4.30.0070.0279.97
4.4.20.0070.0179.97
4.4.10.0030.0279.97
4.4.00.0000.0379.97
4.3.110.0130.0209.97
4.3.100.0100.0109.97
4.3.90.0030.0209.97
4.3.80.0130.0309.97
4.3.70.0070.0179.97
4.3.60.0030.0209.97
4.3.50.0030.0209.97
4.3.40.0030.0309.97
4.3.30.0030.0209.97
4.3.20.0000.0239.97
4.3.10.0030.0279.97
4.3.00.0000.0236.81