3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface MyInterface { public function get(): int; public function set(int $value); } class Factory { private $instance = null; public function getInstance(): MyInterface { if ($this->instance === null) { $this->instance = new class() implements MyInterface { private static $instanciated = false; public function __construct() { if (self::$instanciated) { throw new RuntimeException('Could not instanciate class'); } self::$instanciated = true; } private $var; public function get(): int { return $this->var; } public function set(int $value) { $this->var = $value; } }; } return $this->instance; } } function display(MyInterface $object) { var_dump($object->get()); } $factory = new Factory(); $o = $factory->getInstance(); $o->set(5); $o2 = $factory->getInstance(); display($o2);

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)
8.3.70.0030.01318.55
8.3.60.0090.00916.61
8.3.50.0100.01022.05
8.3.40.0070.00718.68
8.3.30.0100.00318.84
8.3.20.0040.01120.29
8.3.10.0080.00023.48
8.3.00.0080.00019.38
8.2.190.0180.00318.00
8.2.180.0160.00618.41
8.2.170.0070.00722.96
8.2.160.0100.00320.24
8.2.150.0000.00824.18
8.2.140.0040.00424.66
8.2.130.0080.00026.16
8.2.120.0030.00717.75
8.2.110.0090.00322.08
8.2.100.0080.00417.80
8.2.90.0050.00319.09
8.2.80.0080.00017.97
8.2.70.0030.00617.49
8.2.60.0080.00017.93
8.2.50.0060.00318.07
8.2.40.0030.00619.39
8.2.30.0000.00720.68
8.2.20.0040.00417.69
8.2.10.0040.00417.95
8.2.00.0000.00818.18
8.1.280.0070.01025.92
8.1.270.0030.00523.91
8.1.260.0080.00026.35
8.1.250.0040.00428.09
8.1.240.0060.00320.75
8.1.230.0120.00317.80
8.1.220.0040.00417.74
8.1.210.0030.00618.77
8.1.200.0030.00617.48
8.1.190.0000.00817.35
8.1.180.0060.00318.10
8.1.170.0030.00519.03
8.1.160.0050.00222.07
8.1.150.0040.00418.81
8.1.140.0060.00319.58
8.1.130.0000.00717.63
8.1.120.0050.00317.39
8.1.110.0070.00017.38
8.1.100.0050.00317.57
8.1.90.0030.00517.40
8.1.80.0040.00717.49
8.1.70.0000.00717.43
8.1.60.0040.00417.65
8.1.50.0050.00317.51
8.1.40.0040.00417.50
8.1.30.0050.00317.61
8.1.20.0080.00017.60
8.1.10.0040.00417.61
8.1.00.0040.00417.57
8.0.300.0040.00418.77
8.0.290.0000.00816.75
8.0.280.0000.00718.51
8.0.270.0040.00417.28
8.0.260.0030.00317.27
8.0.250.0080.00017.06
8.0.240.0030.00617.04
8.0.230.0030.00717.00
8.0.220.0050.00217.02
8.0.210.0000.00816.96
8.0.200.0000.00717.10
8.0.190.0040.00417.05
8.0.180.0080.00016.91
8.0.170.0000.00817.01
8.0.160.0000.00716.95
8.0.150.0070.00016.80
8.0.140.0030.00416.87
8.0.130.0050.00013.44
8.0.120.0060.00316.96
8.0.110.0000.00716.96
8.0.100.0000.00716.91
8.0.90.0000.00716.90
8.0.80.0070.00717.02
8.0.70.0000.00816.75
8.0.60.0040.00416.99
8.0.50.0030.00516.98
8.0.30.0110.00917.14
8.0.20.0090.01317.40
8.0.10.0000.00717.11
8.0.00.0090.01516.86
7.4.330.0060.00015.13
7.4.320.0000.00616.61
7.4.300.0000.00716.61
7.4.290.0030.00316.60
7.4.280.0040.00416.51
7.4.270.0070.00016.46
7.4.260.0030.00316.46
7.4.250.0000.00716.43
7.4.240.0070.00016.54
7.4.230.0000.00816.49
7.4.220.0060.01216.46
7.4.210.0100.00616.59
7.4.200.0000.00716.46
7.4.160.0090.00616.56
7.4.150.0090.00917.40
7.4.140.0110.01417.86
7.4.130.0050.01316.54
7.4.120.0100.00716.51
7.4.110.0100.01316.39
7.4.100.0060.01216.51
7.4.90.0070.01016.75
7.4.80.0100.01319.39
7.4.70.0170.00416.49
7.4.60.0100.00716.43
7.4.50.0000.00916.42
7.4.40.0120.00316.73
7.4.30.0110.00716.59
7.4.00.0090.00615.16
7.3.330.0050.00013.27
7.3.320.0050.00013.18
7.3.310.0070.00016.34
7.3.300.0000.00816.32
7.3.290.0070.00016.29
7.3.280.0080.00916.27
7.3.270.0100.00717.40
7.3.260.0070.01416.41
7.3.250.0100.00716.45
7.3.240.0100.00716.41
7.3.230.0070.01316.50
7.3.210.0050.01316.30
7.3.200.0030.01416.44
7.3.190.0080.00816.48
7.3.180.0060.01016.65
7.3.170.0090.00916.46
7.3.160.0120.00316.23
7.3.120.0030.01214.80
7.3.110.0000.01514.48
7.3.100.0060.00914.82
7.3.90.0070.00714.64
7.3.80.0080.00415.08
7.3.70.0040.00714.77
7.3.60.0040.01114.95
7.3.50.0060.00615.05
7.3.40.0040.00814.66
7.3.30.0070.01014.78
7.3.20.0110.00416.67
7.3.10.0040.00816.79
7.3.00.0060.00316.75
7.2.330.0060.01016.78
7.2.320.0140.00516.77
7.2.310.0030.01516.69
7.2.300.0120.00616.78
7.2.290.0100.00716.78
7.2.240.0070.01014.84
7.2.230.0040.01114.96
7.2.220.0060.00915.34
7.2.210.0070.01015.07
7.2.200.0030.01315.21
7.2.190.0000.01614.79
7.2.180.0100.00715.11
7.2.170.0110.00314.96
7.2.160.0070.00715.08
7.2.150.0090.00616.87
7.2.140.0130.00316.88
7.2.130.0100.00616.82
7.2.120.0130.00316.73
7.2.110.0030.00716.72
7.2.100.0060.00917.03
7.2.90.0040.01516.88
7.2.80.0030.00816.79
7.2.70.0030.01317.19
7.2.60.0100.00416.99
7.2.50.0040.00817.09
7.2.40.0040.01517.16
7.2.30.0120.00316.75
7.2.20.0040.01116.79
7.2.10.0030.01317.20
7.2.00.0030.01117.97
7.1.330.0060.00615.90
7.1.320.0070.00715.46
7.1.310.0000.01215.83
7.1.300.0140.00315.37
7.1.290.0030.01015.88
7.1.280.0070.00715.79
7.1.270.0100.00715.58
7.1.260.0040.01116.03
7.1.250.0040.01115.87
7.1.200.0100.00315.73
7.1.100.0030.00918.07
7.1.70.0090.00317.12
7.1.60.0030.01219.43
7.1.50.0040.00817.04
7.1.00.0100.07022.33
7.0.200.0250.01114.66
7.0.60.0100.06019.95
7.0.50.0030.06317.74
7.0.40.0130.03320.11
7.0.30.0400.07720.25
7.0.20.0330.07720.25
7.0.10.0030.05720.10
7.0.00.0100.06720.08
5.6.280.0030.04020.91
5.6.210.0070.05320.70
5.6.200.0100.07318.29
5.6.190.0070.04320.67
5.6.180.0300.07020.42
5.6.170.0300.07020.58
5.6.160.0000.05720.57
5.6.150.0070.08018.18
5.6.140.0130.07718.19
5.6.130.0100.08018.26
5.6.120.0100.08321.13
5.6.110.0070.07720.96
5.6.100.0200.07020.93
5.6.90.0130.06720.96
5.6.80.0100.04020.35
5.5.350.0430.06320.46
5.5.340.0030.06017.98
5.5.330.0200.07320.29
5.5.320.0200.04320.25
5.5.310.0270.08320.34
5.5.300.0100.03717.94
5.5.290.0000.09017.96
5.5.280.0130.08020.89
5.5.270.0030.07020.89
5.5.260.0130.06020.89
5.5.250.0100.07720.68
5.5.240.0130.07320.16
5.4.450.0200.05319.09
5.4.440.0170.05319.55
5.4.430.0230.04319.32
5.4.420.0200.04719.26
5.4.410.0130.05319.16
5.4.400.0200.05019.23
5.4.390.0170.07018.94
5.4.380.0170.05018.95
5.4.370.0100.06718.96
5.4.360.0170.05319.00
5.4.350.0230.04318.91
5.4.340.0200.07318.95
5.4.320.0130.05318.99
5.4.310.0230.04319.13
5.4.300.0200.04719.14
5.4.290.0170.04718.99
5.4.280.0130.05318.96
5.4.270.0100.05719.17
5.4.260.0330.03319.26
5.4.250.0230.04318.84
5.4.240.0200.04719.27
5.4.230.0170.05718.93
5.4.220.0230.04318.82
5.4.210.0030.06318.82
5.4.200.0170.04718.82
5.4.190.0200.04719.07
5.4.180.0300.03719.13
5.4.170.0100.05719.11
5.4.160.0130.05318.96
5.4.150.0130.05318.80
5.4.140.0100.05316.32
5.4.130.0070.05316.32
5.4.120.0130.05016.47
5.4.110.0170.04716.47
5.4.100.0130.04716.25
5.4.90.0170.06016.28
5.4.80.0200.04016.43
5.4.70.0230.03716.46
5.4.60.0170.04316.57
5.4.50.0230.03716.55
5.4.40.0130.05316.31
5.4.30.0170.04316.42
5.4.20.0070.05316.55
5.4.10.0200.04316.55
5.4.00.0100.05315.77

preferences:
51.4 ms | 401 KiB | 5 Q