3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface ConfigValueInterface { public function __toString(); } interface ConfigWriterInterface { public function write(ConfigValueInterface $value); } class WriteManager { protected $writers = []; public function addWriter(ConfigWriterInterface $writer, $value_class) { $this->writers[$value_class] = $writer; } public function write(ConfigValueInterface $value) { $class = get_class($value); if (isset($this->writers[$class])) { $this->writers[$class]->write($value); } } } class BaseConfigValue implements ConfigValueInterface { public $storage_location; public function __toString() { return "derp"; } } class BaseConfigWriter implements ConfigWriterInterface { public function write(BaseConfigValue $value) { echo "writing to {$value->storage_location}"; } } class ExampleGenerator { public function generate() { $value = new BaseConfigValue(); $value->storage_location = "/some/path/sample.config"; return $value; } } // Set up manager $manager = new WriteManager(); $manager->addWriter(new BaseConfigWriter, BaseConfigValue::class); $generator = new ExampleGenerator(); $value = $generator->generate(); $manager->write($value);

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.0090.00616.74
8.3.50.0090.00722.00
8.3.40.0090.00618.67
8.3.30.0040.01518.42
8.3.20.0120.00320.34
8.3.10.0040.00423.53
8.3.00.0040.00419.66
8.2.180.0110.01118.55
8.2.170.0060.00822.96
8.2.160.0070.00720.29
8.2.150.0040.00424.18
8.2.140.0000.00724.66
8.2.130.0040.00419.39
8.2.120.0040.00426.35
8.2.110.0080.00322.08
8.2.100.0040.00817.91
8.2.90.0000.00819.09
8.2.80.0030.00517.97
8.2.70.0080.00017.50
8.2.60.0030.00618.04
8.2.50.0000.00818.07
8.2.40.0050.00322.41
8.2.30.0040.00420.56
8.2.20.0000.00717.55
8.2.10.0000.00717.92
8.2.00.0000.00718.12
8.1.280.0120.00425.92
8.1.270.0150.00320.33
8.1.260.0100.00728.09
8.1.250.0040.00428.09
8.1.240.0030.00623.92
8.1.230.0040.00717.77
8.1.220.0030.00617.74
8.1.210.0040.00418.77
8.1.200.0030.00617.11
8.1.190.0000.00917.23
8.1.180.0000.00818.10
8.1.170.0040.00418.39
8.1.160.0020.00520.63
8.1.150.0000.00718.92
8.1.140.0030.00519.59
8.1.130.0070.00017.67
8.1.120.0000.00717.46
8.1.110.0000.00817.43
8.1.100.0040.00417.38
8.1.90.0000.00817.35
8.1.80.0040.00417.47
8.1.70.0000.00717.34
8.1.60.0000.00817.46
8.1.50.0000.00817.51
8.1.40.0030.00617.43
8.1.30.0030.00617.54
8.1.20.0000.00717.58
8.1.10.0040.00417.45
8.1.00.0050.00317.35
8.0.300.0050.00218.77
8.0.290.0000.00716.75
8.0.280.0040.00418.44
8.0.270.0000.00717.26
8.0.260.0060.00017.21
8.0.250.0070.00016.88
8.0.240.0000.00716.84
8.0.230.0000.00717.00
8.0.220.0000.00716.89
8.0.210.0070.00016.93
8.0.200.0030.00316.93
8.0.190.0040.00417.03
8.0.180.0000.00716.94
8.0.170.0090.00316.91
8.0.160.0080.00016.91
8.0.150.0030.00416.69
8.0.140.0040.00416.71
8.0.130.0050.00013.38
8.0.120.0040.00516.90
8.0.110.0040.00416.74
8.0.100.0050.00216.79
8.0.90.0000.00716.75
8.0.80.0070.01016.86
8.0.70.0080.00016.82
8.0.60.0040.00416.90
8.0.50.0000.00716.97
8.0.30.0110.01017.06
8.0.20.0100.00917.40
8.0.10.0000.00816.90
8.0.00.0120.00716.76
7.4.330.0060.00016.73
7.4.320.0070.00016.60
7.4.300.0000.00716.41
7.4.290.0070.00016.60
7.4.280.0000.00916.44
7.4.270.0000.00716.61
7.4.260.0060.00616.51
7.4.250.0000.00716.52
7.4.240.0020.00516.56
7.4.230.0070.00016.44
7.4.220.0060.01516.39
7.4.210.0060.00816.56
7.4.200.0040.00416.46
7.4.160.0120.00416.50
7.4.150.0140.00417.40
7.4.140.0130.00817.86
7.4.130.0110.00616.41
7.4.120.0030.01716.43
7.4.110.0110.00716.42
7.4.100.0070.01716.48
7.4.90.0030.01416.34
7.4.80.0110.00719.39
7.4.70.0080.00816.41
7.4.60.0110.00716.22
7.4.50.0000.01416.32
7.4.40.0110.01116.34
7.4.30.0070.01016.28
7.4.00.0030.01415.06
7.3.330.0000.00613.11
7.3.320.0000.00613.11
7.3.310.0040.00416.10
7.3.300.0000.00716.18
7.3.290.0080.00916.23
7.3.280.0080.01316.29
7.3.270.0120.00617.40
7.3.260.0150.00916.44
7.3.250.0070.01316.41
7.3.240.0110.00816.30
7.3.230.0100.00716.45
7.3.210.0060.01316.36
7.3.200.0120.00616.17
7.3.190.0030.01316.46
7.3.180.0070.01016.54
7.3.170.0090.00916.33
7.3.160.0100.00716.41
7.2.330.0070.01116.59
7.2.320.0150.00316.60
7.2.310.0100.00716.67
7.2.300.0100.00616.36
7.2.290.0030.01416.40
7.2.60.0030.01316.85
7.2.00.0070.01419.35
7.1.200.0000.01215.56
7.1.100.0100.00317.97
7.1.70.0070.00016.90
7.1.60.0090.01519.13
7.1.50.0060.01616.81
7.1.00.0000.08022.57
7.0.200.0650.01014.65
7.0.60.0030.09020.05
7.0.50.0200.07017.87
7.0.40.0130.08319.96
7.0.30.0230.07320.24
7.0.20.0300.07720.25
7.0.10.0030.08720.30
7.0.00.0100.04020.23
5.6.280.0100.04321.09
5.6.210.0070.07320.49
5.6.200.0100.08318.22
5.6.190.0230.06320.49
5.6.180.0070.09320.48
5.6.170.0270.08320.51
5.6.160.0070.09020.46
5.6.150.0130.07318.17
5.6.140.0070.05018.30
5.6.130.0000.05018.28
5.6.120.0000.04321.16
5.6.110.0070.09021.02
5.6.100.0130.08021.13
5.6.90.0100.03720.95
5.6.80.0130.08020.43
5.5.350.0270.08020.48
5.5.340.0130.07717.94
5.5.330.0100.04720.57
5.5.320.0200.08020.35
5.5.310.0300.07720.19
5.5.300.0100.08017.95
5.5.290.0130.06317.94
5.5.280.0070.08320.89
5.5.270.0100.03720.81
5.5.260.0130.07720.91
5.5.250.0100.08320.68
5.5.240.0230.05020.25

preferences:
57.16 ms | 401 KiB | 5 Q