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(); $factory2 = new Factory(); $o3 = $factory->getInstance(); display($o3);

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.60.0040.01116.75
8.3.50.0130.00821.99
8.3.40.0000.01518.62
8.3.30.0120.00318.50
8.3.20.0040.00420.21
8.3.10.0070.00023.80
8.3.00.0030.00619.50
8.2.180.0060.01518.13
8.2.170.0070.01022.96
8.2.160.0070.00720.52
8.2.150.0040.00424.18
8.2.140.0000.00824.66
8.2.130.0040.00426.16
8.2.120.0090.00317.38
8.2.110.0090.00021.00
8.2.100.0060.00617.52
8.2.90.0080.00017.90
8.2.80.0030.00617.97
8.2.70.0000.00817.49
8.2.60.0030.00518.16
8.2.50.0090.00018.07
8.2.40.0030.00619.42
8.2.30.0000.00720.52
8.2.20.0040.00417.74
8.2.10.0000.00818.19
8.2.00.0000.00717.96
8.1.280.0040.01125.92
8.1.270.0080.00023.96
8.1.260.0000.00826.35
8.1.250.0070.00028.09
8.1.240.0090.00022.53
8.1.230.0070.00420.91
8.1.220.0040.00417.74
8.1.210.0000.00918.84
8.1.200.0060.00317.35
8.1.190.0050.00317.35
8.1.180.0080.00018.10
8.1.170.0000.00818.96
8.1.160.0000.00721.96
8.1.150.0030.00518.90
8.1.140.0030.00519.64
8.1.130.0000.00717.66
8.1.120.0000.00717.55
8.1.110.0030.00317.52
8.1.100.0090.00017.53
8.1.90.0000.00717.44
8.1.80.0040.00717.47
8.1.70.0030.00517.46
8.1.60.0000.00817.61
8.1.50.0000.00917.60
8.1.40.0080.00017.48
8.1.30.0000.00917.67
8.1.20.0050.00317.58
8.1.10.0040.00417.67
8.1.00.0030.00617.39
8.0.300.0070.00020.04
8.0.290.0000.00716.75
8.0.280.0030.00318.46
8.0.270.0000.00717.33
8.0.260.0000.00617.34
8.0.250.0070.00017.01
8.0.240.0000.00816.98
8.0.230.0030.00816.94
8.0.220.0050.00516.98
8.0.210.0040.00416.88
8.0.200.0000.00616.90
8.0.190.0040.00416.91
8.0.180.0040.00416.98
8.0.170.0080.00016.89
8.0.160.0000.00716.94
8.0.150.0050.00216.91
8.0.140.0000.00716.88
8.0.130.0030.00313.44
8.0.120.0030.00516.93
8.0.110.0000.00716.96
8.0.100.0040.00417.00
8.0.90.0040.00416.85
8.0.80.0190.00017.04
8.0.70.0000.00717.02
8.0.60.0050.00216.85
8.0.50.0000.00717.01
8.0.30.0120.00817.02
8.0.20.0150.00617.40
8.0.10.0040.00417.01
8.0.00.0120.00816.87
7.4.330.0050.00015.08
7.4.320.0030.00316.64
7.4.300.0060.00016.52
7.4.290.0000.00716.61
7.4.280.0030.00616.52
7.4.270.0030.00316.65
7.4.260.0000.00816.47
7.4.250.0000.00716.58
7.4.240.0000.00716.60
7.4.230.0000.00716.47
7.4.220.0100.01316.66
7.4.210.0060.01116.61
7.4.200.0030.00316.61
7.4.160.0130.00316.49
7.4.150.0090.00917.40
7.4.140.0090.01217.86
7.4.130.0100.01016.57
7.4.120.0090.00916.49
7.4.110.0090.00816.32
7.4.100.0100.01116.47
7.4.90.0000.01816.28
7.4.80.0140.00619.39
7.4.70.0080.00816.35
7.4.60.0070.01116.56
7.4.50.0050.00016.38
7.4.40.0110.00516.55
7.4.30.0060.01116.50
7.4.00.0030.01314.92
7.3.330.0000.00513.23
7.3.320.0000.00613.38
7.3.310.0030.00316.30
7.3.300.0000.00616.27
7.3.290.0000.00716.30
7.3.280.0090.01016.32
7.3.270.0150.00617.40
7.3.260.0080.00816.39
7.3.250.0130.00616.45
7.3.240.0060.01216.25
7.3.230.0120.00616.40
7.3.210.0070.01016.29
7.3.200.0130.00316.59
7.3.190.0060.00916.59
7.3.180.0060.01116.51
7.3.170.0090.00916.37
7.3.160.0060.01016.32
7.2.330.0070.01016.36
7.2.320.0150.00616.65
7.2.310.0100.00716.51
7.2.300.0110.00716.57
7.2.290.0110.00716.48
7.2.60.0040.01116.80
7.2.00.0100.00719.32
7.1.200.0060.00315.64
7.1.100.0060.00618.14
7.1.70.0000.00917.23
7.1.60.0100.01419.43
7.1.50.0080.00316.89
7.1.00.0070.07022.48
7.0.200.0230.00714.71
7.0.60.0130.07719.81
7.0.50.0070.08018.00
7.0.40.0070.04020.13
7.0.30.0270.04320.16
7.0.20.0400.06720.26
7.0.10.0030.04320.24
7.0.00.0070.06720.07
5.6.280.0000.06721.00
5.6.210.0070.03720.63
5.6.200.0030.04318.20
5.6.190.0070.08320.28
5.6.180.0370.07320.61
5.6.170.0300.07320.47
5.6.160.0000.06020.46
5.6.150.0130.07318.21
5.6.140.0070.04318.12
5.6.130.0070.08018.14
5.6.120.0130.07721.14
5.6.110.0200.06720.98
5.6.100.0100.09021.01
5.6.90.0070.05020.96
5.6.80.0100.07720.29
5.5.350.0270.07020.33
5.5.340.0070.04717.99
5.5.330.0070.05020.43
5.5.320.0200.04020.34
5.5.310.0370.06320.19
5.5.300.0000.04017.98
5.5.290.0030.07318.08
5.5.280.0030.04320.77
5.5.270.0070.04020.77
5.5.260.0070.04320.98
5.5.250.0070.07720.62
5.5.240.0170.07020.24
5.4.450.0700.06019.42
5.4.440.0870.05719.53
5.4.430.0670.05319.27
5.4.420.0630.06019.31
5.4.410.0630.06019.19
5.4.400.0870.05018.76
5.4.390.0770.05319.09
5.4.380.0770.05019.07
5.4.370.0700.05319.00
5.4.360.0830.05018.95
5.4.350.0870.05718.94
5.4.340.1000.06019.14
5.4.320.0730.05318.99
5.4.310.0670.05719.09
5.4.300.0730.05719.18
5.4.290.0630.05018.96
5.4.280.0630.06018.94
5.4.270.0630.05319.08
5.4.260.0830.05719.15
5.4.250.0730.05018.98
5.4.240.0870.03718.94
5.4.230.0530.06719.10
5.4.220.0100.05318.93
5.4.210.0600.05018.99
5.4.200.0570.05719.12
5.4.190.0570.05719.11
5.4.180.0770.05019.27
5.4.170.0770.04318.98
5.4.160.0870.04018.95
5.4.150.0570.06019.10
5.4.140.0100.05016.39
5.4.130.0630.04016.45
5.4.120.0770.05016.44
5.4.110.0770.04716.20
5.4.100.0870.05316.63
5.4.90.0830.05716.56
5.4.80.0730.04716.56
5.4.70.0830.03716.55
5.4.60.0070.06316.55
5.4.50.0300.03716.44
5.4.40.0100.05716.58
5.4.30.0200.06316.35
5.4.20.0200.07316.35
5.4.10.0170.07016.57
5.4.00.0230.04715.89

preferences:
44.62 ms | 401 KiB | 5 Q