3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MyClass { private static $instance = null; private $my_value = 'Foo'; public function __construct() { } public static function my_function() { if ( ! isSet(self::$instance)) self::$instance = new self; if(isSet($this)) $target = $this; else $target = self::$instance; } return $target->my_value; } } $my_object = new MyClass(); echo $my_object->my_function()."\n"; echo MyClass::my_function();

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.0100.06018.94
5.4.240.0130.06318.79
5.4.230.0100.05318.80
5.4.220.0270.05719.00
5.4.210.0170.04319.00
5.4.200.0130.05318.95
5.4.190.0130.05018.93
5.4.180.0030.07019.00
5.4.170.0070.07019.00
5.4.160.0070.08018.89
5.4.150.0100.05018.93
5.4.140.0130.04716.36
5.4.130.0070.04716.36
5.4.120.0130.04716.36
5.4.110.0030.05316.35
5.4.100.0100.04716.49
5.4.90.0070.05016.57
5.4.80.0070.07316.61
5.4.70.0170.04016.37
5.4.60.0200.04016.48
5.4.50.0030.05016.45
5.4.40.0170.05716.40
5.4.30.0000.06016.38
5.4.20.0170.06316.46
5.4.10.0070.05316.34
5.4.00.0200.04015.99
5.3.280.0070.06314.59
5.3.270.0030.07314.70
5.3.260.0200.06314.68
5.3.250.0130.04314.63
5.3.240.0070.05014.72
5.3.230.0070.05314.82
5.3.220.0270.05314.54
5.3.210.0130.04714.56
5.3.200.0030.06314.48
5.3.190.0070.05014.66
5.3.180.0200.05714.40
5.3.170.0070.05014.66
5.3.160.0130.04714.79
5.3.150.0130.04714.58
5.3.140.0070.05014.55
5.3.130.0030.05714.46
5.3.120.0170.04314.78
5.3.110.0070.05314.54
5.3.100.0070.07314.11
5.3.90.0100.04714.11
5.3.80.0200.05714.04
5.3.70.0170.06014.01
5.3.60.0030.05314.02
5.3.50.0200.03714.04
5.3.40.0170.05714.17
5.3.30.0070.06313.88
5.3.20.0100.04713.67
5.3.10.0170.06313.73
5.3.00.0100.05013.72

preferences:
139.31 ms | 1394 KiB | 7 Q