3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Singleton { private static $instance = null; final private function __construct() {} final private function __clone() {} public function __wakeup() { throw new Exception("Cannot unserialize singleton"); } 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(); // $thirdInstance = clone $oneInstance; var_dump($secondInstance); var_dump(new ReflectionClass($secondInstance)->getMethods());

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).

VersionSystem time (s)User time (s)Memory (MiB)
5.4.250.0070.06018.64
5.4.240.0070.07318.76
5.4.230.0070.06018.96
5.4.220.0070.06318.76
5.4.210.0100.07018.79
5.4.200.0170.04018.96
5.4.190.0130.06318.98
5.4.180.0070.07018.78
5.4.170.0070.05318.93
5.4.160.0130.05018.82
5.4.150.0100.05318.64
5.4.140.0070.05016.42
5.4.130.0100.07316.62
5.4.120.0200.04716.43
5.4.110.0130.04316.46
5.4.100.0230.03016.71
5.4.90.0130.06716.55
5.4.80.0130.06016.52
5.4.70.0030.05016.59
5.4.60.0200.03316.53
5.4.50.0070.05016.39
5.4.40.0130.04316.65
5.4.30.0070.04716.42
5.4.20.0100.06016.35
5.4.10.0100.04716.52
5.4.00.0070.04716.01
5.3.280.0070.05014.50
5.3.270.0130.04714.51
5.3.260.0100.06714.58
5.3.250.0100.04714.70
5.3.240.0030.05714.69
5.3.230.0100.06014.83
5.3.220.0070.05014.68
5.3.210.0070.07314.63
5.3.200.0200.04314.49
5.3.190.0070.05014.74
5.3.180.0030.06014.55
5.3.170.0200.03714.66
5.3.160.0130.04314.66
5.3.150.0030.05314.55
5.3.140.0070.04714.64
5.3.130.0130.04314.66
5.3.120.0030.05314.46
5.3.110.0100.05014.66
5.3.100.0070.05713.87
5.3.90.0130.04714.11
5.3.80.0070.07014.08
5.3.70.0070.05014.11
5.3.60.0130.04313.91
5.3.50.0100.04313.95
5.3.40.0070.05314.18
5.3.30.0000.05313.98
5.3.20.0030.05013.78
5.3.10.0030.05013.82
5.3.00.0070.07013.80

preferences:
136.8 ms | 1394 KiB | 7 Q