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() {die();} 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.3.0rc40.0200.00098.97
7.3.0rc30.0180.00516.77
7.3.0beta10.0190.00312.61
7.3.0alpha10.0060.00912.69
7.2.60.0160.00017.09
7.2.50.0060.00816.98
7.1.200.0060.00915.50
7.1.100.0000.00817.95
7.1.70.0040.00716.93
7.1.60.0110.01119.70
7.1.50.0040.01416.92
7.1.00.0030.07722.48
7.0.200.0000.00716.86
7.0.140.0000.07722.15
7.0.60.0100.08320.00
7.0.50.0030.06717.87
7.0.40.0100.07320.11
7.0.30.0270.07720.21
7.0.20.0230.05320.09
7.0.10.0100.08020.19
7.0.00.0130.04020.15
5.6.280.0100.06721.11
5.6.210.0000.07020.73
5.6.200.0070.08018.19
5.6.190.0070.07720.67
5.6.180.0230.07720.52
5.6.170.0230.04720.45
5.6.160.0070.04020.52
5.6.150.0100.06018.27
5.6.140.0070.05718.32
5.6.130.0100.08318.24
5.6.120.0000.07721.03
5.6.110.0070.08321.04
5.6.100.0030.04021.00
5.6.90.0000.04320.88
5.6.80.0030.08720.45
5.5.350.3100.04020.41
5.5.340.0070.07717.98
5.5.330.0070.06020.43
5.5.320.0130.08020.36
5.5.310.0330.07320.25
5.5.300.0100.06717.95
5.5.290.0070.08018.02
5.5.280.0170.07320.86
5.5.270.0100.08020.98
5.5.260.0100.08020.68
5.5.250.0030.09020.55
5.5.240.0230.07020.02
5.4.450.0300.07719.49
5.4.440.0370.07319.41
5.4.430.0270.05319.38
5.4.420.0330.06019.44
5.4.410.0300.05019.43
5.4.400.0430.06318.98
5.4.390.0370.04018.86
5.4.380.0370.04719.14
5.4.370.0330.05719.09
5.4.360.0270.04019.09
5.4.350.0430.06019.12
5.4.340.0400.07019.23
5.4.320.0370.07019.17
5.4.310.0330.03318.98
5.4.300.0400.06319.16
5.4.290.0270.04719.21
5.4.280.0400.04019.30
5.4.270.0270.07719.07
5.4.260.0370.06319.28
5.4.250.0370.04718.83
5.4.240.0270.03719.21
5.4.230.0330.04718.99
5.4.220.0430.06018.83
5.4.210.0470.04718.94
5.4.200.0330.05019.14
5.4.190.0400.04319.02
5.4.180.0400.04319.07
5.4.170.0430.06318.98
5.4.160.0400.06318.79
5.4.150.0430.05319.20
5.4.140.0430.04316.50
5.4.130.0330.04716.49
5.4.120.0270.05316.35
5.4.110.0300.03316.41
5.4.100.0300.03716.55
5.4.90.0270.03316.37
5.4.80.0270.07316.57
5.4.70.0330.06716.24
5.4.60.0430.03016.33
5.4.50.0400.06016.23
5.4.40.0470.06016.16
5.4.30.0200.04316.52
5.4.20.0370.06316.55
5.4.10.0430.06316.42
5.4.00.0530.05315.93
5.3.290.0400.07014.68
5.3.280.0470.06014.62
5.3.270.0430.05714.50
5.3.260.0270.05014.62
5.3.250.0300.04014.63
5.3.240.0300.06714.76
5.3.230.0370.06714.75
5.3.220.0400.06714.57
5.3.210.0370.04014.48
5.3.200.0370.06714.72
5.3.190.0300.06714.54
5.3.180.0270.04314.55
5.3.170.0230.04014.56
5.3.160.0270.03714.64
5.3.150.0370.04314.57
5.3.140.0430.06014.53
5.3.130.0430.06014.63
5.3.120.0330.03314.54
5.3.110.0270.03714.47
5.3.100.0330.03013.95
5.3.90.0300.04714.25
5.3.80.0370.05713.93
5.3.70.0330.06713.95
5.3.60.0370.06714.01
5.3.50.0300.05014.02
5.3.40.0330.06714.07
5.3.30.0300.04713.97
5.3.20.0300.06013.59
5.3.10.0430.03313.74
5.3.00.0300.07013.66
5.2.170.0270.05713.00
5.2.160.0200.05013.00
5.2.150.0270.04313.00
5.2.140.0230.02713.00
5.2.130.0200.03713.00
5.2.120.0230.03013.00
5.2.110.0300.04313.00
5.2.100.0170.03013.00
5.2.90.0170.03013.00
5.2.80.0370.03313.00
5.2.70.0200.03313.00
5.2.60.0300.03313.00
5.2.50.0270.05313.00
5.2.40.0130.03313.00
5.2.30.0230.05013.00
5.2.20.0200.03313.00
5.2.10.0230.04013.00
5.2.00.0270.02713.00
5.1.60.0230.02313.00
5.1.50.0270.01713.00
5.1.40.0200.05313.00
5.1.30.0200.05313.00
5.1.20.0330.04013.00
5.1.10.0170.03313.00
5.1.00.0170.04713.00
5.0.50.0100.02313.00
5.0.40.0100.04013.00
5.0.30.0170.05013.00
5.0.20.0170.04013.00
5.0.10.0100.04013.00
5.0.00.0170.02713.00
4.4.90.0100.03313.00
4.4.80.0070.02713.00
4.4.70.0100.03313.00
4.4.60.0270.02013.00
4.4.50.0130.01313.00
4.4.40.0070.03713.00
4.4.30.0100.03313.00
4.4.20.0100.02313.00
4.4.10.0100.02713.00
4.4.00.0130.03313.00
4.3.110.0100.02313.00
4.3.100.0100.02013.00
4.3.90.0070.03013.00
4.3.80.0130.03013.00
4.3.70.0170.03013.00
4.3.60.0100.01713.00
4.3.50.0200.03013.00
4.3.40.0070.06013.00
4.3.30.0070.03313.00
4.3.20.0070.02013.00
4.3.10.0100.01713.00
4.3.00.0070.02313.00