3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Singleton { private function __construct(){} private function __clone(){} private function __sleep(){} private function __wakeup(){} private static $instance; public static function getInstance() { if ( ! self::$instance) { self::$instance = new static(); } return self::$instance; } } $obj1 = Singleton::getInstance(); $obj2 = Singleton::getInstance(); var_dump(spl_object_hash($obj1) == spl_object_hash($obj2)); $cloner = function(){ return new function{}( return clone $this; ); }; $obj3 = null; $obj3 = $cloner->bindTo($obj1)->__invoke(); var_dump(spl_object_hash($obj1) == spl_object_hash($obj3));

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.260.0070.07718.91
5.4.250.0070.06318.77
5.4.240.0130.05318.95
5.4.230.0230.05019.01
5.4.220.0130.06318.80
5.4.210.0100.06719.00
5.4.200.0170.06318.96
5.4.190.0030.07318.75
5.4.180.0170.06719.02
5.4.170.0170.06319.02
5.4.160.0170.05018.96
5.4.150.0030.06318.93
5.4.140.0170.04316.37
5.4.130.0200.06316.60
5.4.120.0130.04316.48
5.4.110.0030.05016.47
5.4.100.0070.06316.55
5.4.90.0170.05316.57
5.4.80.0100.05016.61
5.4.70.0070.06316.56
5.4.60.0070.07016.63
5.4.50.0130.05316.49
5.4.40.0100.06716.50
5.4.30.0130.05716.47
5.4.20.0000.07716.47
5.4.10.0200.05316.38
5.4.00.0100.04715.85
5.3.280.0070.07014.68
5.3.270.0130.06314.63
5.3.260.0030.06314.78
5.3.250.0130.06014.72
5.3.240.0070.07314.71
5.3.230.0170.06014.51
5.3.220.0030.05714.48
5.3.210.0100.06014.41
5.3.200.0130.04314.55
5.3.190.0070.07014.64
5.3.180.0030.07014.65
5.3.170.0070.07714.56
5.3.160.0070.08014.64
5.3.150.0030.07314.66
5.3.140.0070.05314.54
5.3.130.0200.05714.64
5.3.120.0030.08014.63
5.3.110.0070.06314.46
5.3.100.0070.05714.22
5.3.90.0170.05714.02
5.3.80.0100.04714.09
5.3.70.0130.06014.24
5.3.60.0170.05313.84
5.3.50.0030.05314.02
5.3.40.0130.06314.12
5.3.30.0030.06713.99
5.3.20.0130.06013.80
5.3.10.0130.06013.55
5.3.00.0070.06313.73

preferences:
138.43 ms | 1394 KiB | 7 Q