3v4l.org

run code in 300+ PHP versions simultaneously
<?php class IndxedArrayWrapper { private object $properties; public function __construct(array $properties) { $this->properties = (object) []; array_walk($properties, fn($key, $value) => $this->__set($key, $value)); } public function __get(string|int $index): mixed { return $this->properties?->{$index} ?? null; } public function __set(string|int $key, mixed $value): void { $this->properties->{count((array) $this->properties)} = ['key' => $key, 'value' => $value]; } } ['key' => $fruit, 'value' => $colour] = (new IndxedArrayWrapper([ 'apple' => 'red', 'bananna' => 'yellow' ]))->{0}; echo sprintf('At position 0 is a %s %s', $fruit, $colour);

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.5.10.0030.00520.18
8.5.00.0140.00920.39
8.4.150.0020.00114.05
8.4.140.0110.01017.96
8.4.130.0050.00417.80
8.4.120.0100.01024.04
8.4.110.0110.01218.88
8.4.100.0140.00717.94
8.4.90.0110.00820.79
8.4.80.0080.00319.05
8.4.70.0120.00818.84
8.4.60.0130.00720.77
8.4.50.0110.01017.54
8.4.40.0140.00719.52
8.4.30.0060.00320.55
8.4.20.0070.00319.63
8.4.10.0090.00024.07
8.3.280.0100.01218.63
8.3.270.0120.00716.59
8.3.260.0140.00716.62
8.3.250.0120.00719.08
8.3.240.0050.00316.60
8.3.230.0110.00916.66
8.3.220.0040.00418.77
8.3.210.0080.00916.92
8.3.200.0030.00516.77
8.3.190.0080.00716.66
8.3.180.0140.00516.52
8.3.170.0120.00619.13
8.3.160.0140.00418.32
8.3.150.0040.01522.76
8.3.140.0110.00718.52
8.3.130.0060.00316.77
8.3.120.0060.01319.11
8.3.110.0110.00020.94
8.3.100.0060.00316.67
8.3.90.0040.00416.51
8.3.80.0060.00317.97
8.3.70.0090.00916.75
8.3.60.0100.01018.68
8.3.50.0030.01016.57
8.3.40.0070.00722.05
8.3.30.0140.00018.81
8.3.20.0140.00424.18
8.3.10.0040.00424.66
8.3.00.0040.00426.16
8.2.290.0060.00317.37
8.2.280.0110.01020.00
8.2.270.0140.00416.70
8.2.260.0130.00318.20
8.2.250.0040.00416.99
8.2.240.0040.00418.97
8.2.230.0030.00722.58
8.2.220.0070.00724.06
8.2.210.0060.00326.77
8.2.200.0050.00518.29
8.2.190.0080.00816.63
8.2.180.0150.00316.75
8.2.170.0120.00318.96
8.2.160.0070.00722.96
8.2.150.0060.00325.66
8.2.140.0100.01024.66
8.2.130.0090.00926.16
8.2.120.0000.00826.16
8.2.110.0060.00319.21
8.2.100.0050.00818.08
8.2.90.0040.00417.75
8.2.80.0000.00818.89
8.2.70.0040.00417.63
8.2.60.0040.00417.93
8.2.50.0080.00018.07
8.2.40.0080.00018.34
8.2.30.0130.00019.07
8.2.20.0030.01018.91
8.2.10.0120.00019.05
8.2.00.0040.00819.07
8.1.330.0130.00618.09
8.1.320.0110.01016.30
8.1.310.0000.00816.65
8.1.300.0050.00318.60
8.1.290.0070.00318.88
8.1.280.0140.00725.92
8.1.270.0040.00424.66
8.1.260.0120.00326.35
8.1.250.0080.00028.09
8.1.240.0140.00323.77
8.1.230.0070.00422.73
8.1.220.0040.00417.74
8.1.210.0050.00318.77
8.1.200.0060.00317.35
8.1.190.0040.00417.35
8.1.180.0040.00418.10
8.1.170.0060.00318.46
8.1.160.0030.00718.66
8.1.150.0080.00418.54
8.1.140.0040.01218.60
8.1.130.0130.00318.54
8.1.120.0140.00318.79
8.1.110.0110.00618.68
8.1.100.0160.00018.62
8.1.90.0140.00318.70
8.1.80.0130.00318.70
8.1.70.0120.00618.73
8.1.60.0190.00318.89
8.1.50.0100.01018.86
8.1.40.0120.00818.85
8.1.30.0090.00918.87
8.1.20.0160.00318.80
8.1.10.0160.00418.65
8.1.00.0120.00618.70
8.0.300.0040.00418.77
8.0.290.0040.00416.88
8.0.280.0040.00418.41
8.0.270.0070.00717.98
8.0.260.0090.00618.10
8.0.250.0100.00518.16
8.0.240.0120.00318.12
8.0.230.0120.00318.06
8.0.220.0120.00418.01
8.0.210.0100.00517.96
8.0.200.0070.00718.15
8.0.190.0160.00018.17
8.0.180.0090.00618.04
8.0.170.0070.00718.02
8.0.160.0090.00618.17
8.0.150.0140.00318.09
8.0.140.0120.00318.09
8.0.130.0100.00518.15
8.0.120.0130.00218.01
8.0.110.0090.00718.02
8.0.100.0080.00418.08
8.0.90.0050.00617.98
8.0.80.0080.00618.00
8.0.70.0120.00218.13
8.0.60.0120.00517.98
8.0.50.0130.00017.96
8.0.30.0070.00318.07
8.0.20.0060.00818.07
8.0.10.0030.00518.13

preferences:
112.39 ms | 403 KiB | 5 Q