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.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.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:
21.37 ms | 408 KiB | 11 Q