3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { private $query; public function &findNode(array $path) { $link = &$this->query; foreach ($path as $element) { $link = &$link[$element]; } return $link; } public function setValues(array $path, array $values) { $node = &$this->findNode($path); $node = array_merge($node ?? [], $values); unset($node); return $this; } public function setValueByPath(array $path, $value): self { $link = &$this->findNode($path); if (is_array($value)) { $link[] = $value; } else { $link = $value; } unset($link); return $this; } public function print() { print_r($this->query); } } $a = new A; $a ->setValues(['c', 'd'], [['test' => 1], ['test' => 2]]) ->setValues(['c', 'd'], [['test' => 3], ['test' => 4]]); $a ->setValueByPath(['a', 'b', 'c', 'd'], ['match' => 100500]) ->setValueByPath(['a', 'b', 'c', 'd'], ['match' => 1000]) ->setValueByPath(['a', 'b', 'c', 'd', 1, 'zzz'], 'lol'); $a->print();

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.70.0080.00818.55
8.3.60.0090.00618.55
8.3.50.0110.01117.91
8.3.40.0040.01118.79
8.3.30.0110.00318.72
8.3.20.0000.00821.95
8.3.10.0030.00521.64
8.3.00.0090.00019.92
8.2.180.0070.01016.38
8.2.170.0090.00622.96
8.2.160.0110.00422.96
8.2.150.0000.00824.18
8.2.140.0040.00424.66
8.2.130.0040.00419.32
8.2.120.0080.00026.35
8.2.110.0100.00020.93
8.2.100.0090.00317.97
8.2.90.0030.00617.91
8.2.80.0050.00318.22
8.2.70.0050.00318.05
8.2.60.0040.00418.05
8.2.50.0040.00418.22
8.2.40.0060.00320.37
8.2.30.0000.00719.20
8.2.20.0050.00218.07
8.2.10.0050.00218.07
8.2.00.0040.00418.12
8.1.280.0090.00625.92
8.1.270.0080.00023.97
8.1.260.0040.00426.35
8.1.250.0080.00028.09
8.1.240.0060.00323.85
8.1.230.0070.00421.05
8.1.220.0090.00017.79
8.1.210.0030.00718.77
8.1.200.0030.00517.36
8.1.190.0000.00817.38
8.1.180.0030.00618.10
8.1.170.0050.00318.46
8.1.160.0040.00418.80
8.1.150.0060.00320.85
8.1.140.0070.00017.70
8.1.130.0000.00719.03
8.1.120.0000.00717.48
8.1.110.0040.00417.43
8.1.100.0070.00017.43
8.1.90.0040.00417.53
8.1.80.0000.00817.42
8.1.70.0030.00617.48
8.1.60.0040.00417.58
8.1.50.0030.00617.46
8.1.40.0080.00017.43
8.1.30.0030.00617.63
8.1.20.0000.01017.63
8.1.10.0000.00817.64
8.1.00.0040.00417.49
8.0.300.0040.00419.93
8.0.290.0040.00416.75
8.0.280.0040.00418.45
8.0.270.0080.00017.28
8.0.260.0000.00817.28
8.0.250.0040.00417.00
8.0.240.0070.00516.86
8.0.230.0030.00516.92
8.0.220.0030.00316.80
8.0.210.0050.00316.92
8.0.200.0000.00616.98
8.0.190.0040.00416.97
8.0.180.0040.00416.91
8.0.170.0000.00816.94
8.0.160.0030.00416.86
8.0.150.0060.00316.76
8.0.140.0080.00016.91
8.0.130.0000.00613.34
8.0.120.0000.00816.91
8.0.110.0040.00416.96
8.0.100.0070.00016.77
8.0.90.0060.00316.94
8.0.80.0060.00916.93
8.0.70.0000.00716.78
8.0.60.0040.00416.74
8.0.50.0080.00016.91
8.0.30.0040.01417.03
8.0.20.0140.00617.40
8.0.10.0000.00816.84
8.0.00.0090.00816.63
7.4.330.0000.00616.79
7.4.320.0000.00716.62
7.4.300.0030.00316.59
7.4.290.0070.00016.49
7.4.280.0040.00416.62
7.4.270.0000.00716.41
7.4.260.0050.00516.61
7.4.250.0030.00316.57
7.4.240.0070.00016.63
7.4.230.0030.00316.42
7.4.220.0000.00816.49
7.4.210.0080.00716.63
7.4.200.0070.00016.63
7.4.160.0120.00516.48
7.4.140.0080.01217.86
7.4.130.0140.00416.53
7.4.120.0090.01116.53
7.4.110.0120.00616.32
7.4.100.0060.01316.72
7.4.90.0120.00916.57
7.4.80.0150.00919.39
7.4.70.0090.00916.64
7.4.60.0070.01316.58
7.4.50.0080.00316.76
7.4.40.0060.00916.55
7.4.00.0070.00714.99
7.3.330.0040.00413.20
7.3.320.0060.00013.39
7.3.310.0000.00716.23
7.3.300.0070.00016.37
7.3.290.0000.00716.42
7.3.280.0090.00916.36
7.3.260.0090.01016.61
7.3.240.0090.00816.54
7.3.230.0120.00616.71
7.3.210.0100.00716.29
7.3.200.0140.00316.39
7.3.190.0030.01416.46
7.3.180.0070.01016.51
7.3.170.0130.00916.39
7.3.160.0120.00616.40
7.3.10.0090.00316.63
7.3.00.0100.00316.40
7.2.330.0160.00616.43
7.2.320.0160.00616.68
7.2.310.0060.01216.44
7.2.300.0070.01716.39
7.2.290.0000.02116.71
7.2.130.0060.00917.05
7.2.120.0130.00316.89
7.2.110.0030.01216.68
7.2.100.0060.00616.77
7.2.90.0090.00617.10
7.2.80.0060.00917.10
7.2.70.0040.00716.80
7.2.60.0090.00617.08
7.2.50.0130.00317.03
7.2.40.1750.01117.29
7.2.30.0080.01417.71
7.2.20.0090.01217.59
7.2.10.0230.01017.36
7.2.00.0110.00817.28
7.1.250.0060.00615.46
7.1.200.0060.00615.62
7.1.160.0400.01316.86
7.1.150.0090.01116.59
7.1.140.0130.01216.96
7.1.130.0200.00717.08
7.1.120.0120.01516.64
7.1.110.8010.01416.09
7.1.100.5890.01016.06
7.1.90.6420.01116.24
7.1.80.6400.01016.43
7.1.70.5480.01015.19
7.1.60.4840.01233.14
7.1.50.8250.01632.63
7.1.41.0830.01732.65
7.1.30.8800.01332.75
7.1.21.0010.01432.69
7.1.10.7290.01314.82
7.1.00.4840.01414.66

preferences:
54.68 ms | 401 KiB | 5 Q