3v4l.org

run code in 300+ PHP versions simultaneously
<?php final class Config extends ArrayObject { } final class MyClass { public function __construct(Config $config) { // Read settings echo $config['key'] . "\n"; echo $config->offsetGet('key') . "\n"; // Reading a sub-key echo $config['db']['hostname'] . "\n"; echo $config->offsetGet('db')['hostname'] . "\n"; } } // Within the DI container definition // Load settings from settings.php $settings = [ 'key' => 'value', 'db' => [ 'hostname' => '127.0.0.1', ] ]; $config = new Config($settings); // Let the DI container inject this object via autowiring new MyClass($config);

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.4.20.0160.00317.83
8.4.10.0070.00322.29
8.3.150.0090.00918.72
8.3.140.0180.00020.57
8.3.130.0040.00418.38
8.3.120.0090.00618.92
8.3.110.0060.00320.94
8.3.100.0050.00518.47
8.3.90.0110.00726.77
8.3.80.0060.00316.50
8.3.70.0060.00918.23
8.3.60.0180.00316.38
8.3.50.0030.01019.91
8.3.40.0030.01020.43
8.3.30.0080.00818.71
8.3.20.0050.00324.18
8.3.10.0070.00024.66
8.3.00.0030.00526.16
8.2.260.0030.01218.75
8.2.250.0060.00316.83
8.2.240.0040.00417.06
8.2.230.0030.00622.58
8.2.220.0130.00724.06
8.2.210.0000.01526.77
8.2.200.0040.00416.88
8.2.190.0140.00416.58
8.2.180.0130.00325.92
8.2.170.0100.00319.09
8.2.160.0090.00922.96
8.2.150.0000.00725.66
8.2.140.0080.00024.66
8.2.130.0080.00026.16
8.2.120.0000.00720.08
8.2.110.0060.00320.38
8.2.100.0090.00317.91
8.2.90.0000.00819.34
8.2.80.0030.00517.97
8.2.70.0040.00417.63
8.2.60.0030.01317.67
8.2.50.0030.00618.07
8.2.40.0030.00518.34
8.2.30.0040.00418.25
8.2.20.0000.00720.51
8.2.10.0000.00718.07
8.2.00.0090.00019.13
8.1.310.0000.00816.61
8.1.300.0130.00718.08
8.1.290.0060.00330.84
8.1.280.0080.00825.92
8.1.270.0060.00323.99
8.1.260.0050.00326.35
8.1.250.0070.00428.09
8.1.240.0110.00023.81
8.1.230.0120.00021.06
8.1.220.0050.00317.74
8.1.210.0030.00718.77
8.1.200.0060.00317.35
8.1.190.0030.00517.23
8.1.180.0000.00918.10
8.1.170.0030.00618.59
8.1.160.0040.00418.84
8.1.150.0040.00418.56
8.1.140.0000.00717.46
8.1.130.0030.00318.94
8.1.120.0050.00317.52
8.1.110.0040.00417.36
8.1.100.0030.00517.39
8.1.90.0060.00317.48
8.1.80.0000.00917.43
8.1.70.0110.00517.41
8.1.60.0130.00517.46
8.1.50.0160.00317.40
8.1.40.0090.00917.41
8.1.30.0200.00017.68
8.1.20.0100.01017.51
8.1.10.0120.00817.42
8.1.00.0040.01517.50
8.0.300.0030.00518.77
8.0.290.0020.00516.75
8.0.280.0000.00718.46
8.0.270.0000.00716.90
8.0.260.0060.00018.46
8.0.250.0000.00717.04
8.0.240.0000.00917.03
8.0.230.0000.00717.02
8.0.220.0140.00016.77
8.0.210.0110.00516.95
8.0.200.0160.00016.96
8.0.190.0060.00916.96
8.0.180.0110.00616.81
8.0.170.0080.00816.92
8.0.160.0110.00516.92
8.0.150.0130.00316.91
8.0.140.0050.01016.86
8.0.130.0000.00816.91
8.0.120.0130.00316.91
8.0.110.0130.00316.96
8.0.100.0130.00316.88
8.0.90.0050.01016.79
8.0.80.0150.00016.93
8.0.70.0120.00616.81
8.0.60.0080.00916.81
8.0.50.0160.00016.86
8.0.30.0110.00416.70
8.0.20.0090.00916.84
8.0.10.0000.01517.04
7.4.330.0050.00015.55
7.4.320.0000.00716.57
7.4.300.0050.00516.50
7.4.290.0100.00616.59
7.4.280.0150.00416.53
7.4.270.0120.00616.46
7.4.260.0120.00716.58
7.4.250.0110.00716.50
7.4.240.0150.00316.40
7.4.230.0150.00316.46
7.4.220.0060.00516.39
7.4.210.0100.00516.41
7.4.200.0100.00516.58
7.4.190.0060.00616.59
7.4.180.0080.00316.52
7.4.160.0050.01116.58
7.4.150.0110.00516.34
7.4.140.0070.00516.35
7.4.130.0090.00616.33
7.4.120.0170.00016.39
7.4.110.0040.01216.39
7.4.100.0110.00516.58
7.4.90.0060.00916.44
7.4.80.0100.00716.49
7.4.70.0100.00516.36
7.4.60.0080.00616.44
7.4.50.0000.01616.38
7.4.40.0120.00616.43
7.4.30.0090.00616.32
7.4.20.0120.00616.32
7.4.10.0140.00216.41
7.4.00.0160.00016.42

preferences:
36.73 ms | 403 KiB | 5 Q