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() { var_dump($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'); print_r($a);

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.0040.01118.68
8.3.50.0100.00717.85
8.3.40.0080.00818.68
8.3.30.0150.00018.71
8.3.20.0040.00421.74
8.3.10.0040.00421.83
8.3.00.0030.00619.69
8.2.180.0080.00816.38
8.2.170.0150.00622.96
8.2.160.0070.00722.96
8.2.150.0040.00424.18
8.2.140.0030.00524.66
8.2.130.0100.00019.34
8.2.120.0070.00026.35
8.2.110.0100.00021.18
8.2.100.0040.00817.84
8.2.90.0000.01017.91
8.2.80.0030.00618.34
8.2.70.0080.00017.68
8.2.60.0040.00418.03
8.2.50.0030.00518.16
8.2.40.0040.00420.59
8.2.30.0000.00719.34
8.2.20.0040.00418.05
8.2.10.0070.00018.05
8.2.00.0040.00418.16
8.1.280.0080.01225.92
8.1.270.0000.00823.75
8.1.260.0080.00026.35
8.1.250.0040.00428.09
8.1.240.0040.00423.80
8.1.230.0070.00420.89
8.1.220.0000.00817.79
8.1.210.0000.00818.77
8.1.200.0080.00017.35
8.1.190.0040.00417.13
8.1.180.0000.00818.10
8.1.170.0090.00018.64
8.1.160.0000.00718.89
8.1.150.0000.00720.75
8.1.140.0030.00517.72
8.1.130.0040.00418.94
8.1.120.0030.00317.39
8.1.110.0000.00917.35
8.1.100.0040.00317.43
8.1.90.0050.00417.52
8.1.80.0080.00017.42
8.1.70.0070.00417.48
8.1.60.0000.00817.49
8.1.50.0000.00917.49
8.1.40.0000.00817.41
8.1.30.0060.00317.62
8.1.20.0030.00617.68
8.1.10.0030.00517.57
8.1.00.0040.00417.44
8.0.300.0030.00320.03
8.0.290.0070.00016.75
8.0.280.0030.00318.39
8.0.270.0000.00717.25
8.0.260.0030.00317.23
8.0.250.0000.00716.96
8.0.240.0040.00717.01
8.0.230.0000.00817.00
8.0.220.0030.00316.96
8.0.210.0030.00316.97
8.0.200.0040.00416.91
8.0.190.0050.00216.98
8.0.180.0000.00716.86
8.0.170.0090.00016.93
8.0.160.0070.00016.96
8.0.150.0060.00316.79
8.0.140.0070.00016.82
8.0.130.0050.00013.30
8.0.120.0040.00416.87
8.0.110.0070.00016.79
8.0.100.0070.00016.88
8.0.90.0040.00416.96
8.0.80.0080.00816.88
8.0.70.0000.00816.88
8.0.60.0020.00516.85
8.0.50.0080.00016.87
8.0.30.0080.01117.18
8.0.20.0070.01517.42
8.0.10.0000.00717.02
8.0.00.0100.00716.87
7.4.330.0000.00516.67
7.4.320.0030.00316.44
7.4.300.0060.00016.50
7.4.290.0000.00716.58
7.4.280.0040.00416.45
7.4.270.0000.00716.52
7.4.260.0000.01016.59
7.4.250.0000.00716.37
7.4.240.0070.00016.60
7.4.230.0000.00716.61
7.4.220.0070.00016.50
7.4.210.0080.00716.53
7.4.200.0030.00316.37
7.4.160.0070.01116.57
7.4.140.0100.01017.86
7.4.130.0120.00616.64
7.4.120.0100.00616.54
7.4.110.0120.00816.81
7.4.100.0080.00916.36
7.4.90.0080.01216.47
7.4.80.0130.01119.39
7.4.70.0090.00616.45
7.4.60.0030.01816.52
7.4.50.0070.01116.48
7.4.40.0100.00716.40
7.4.00.0030.01214.86
7.3.330.0080.00013.38
7.3.320.0030.00313.33
7.3.310.0080.00016.19
7.3.300.0040.00416.39
7.3.290.0070.00016.38
7.3.280.0120.00616.41
7.3.260.0130.00616.54
7.3.240.0090.00816.52
7.3.230.0140.00316.37
7.3.210.0170.00016.38
7.3.200.0160.00616.61
7.3.190.0080.00916.32
7.3.180.0060.01316.39
7.3.170.0120.00316.41
7.3.160.0040.01216.52
7.3.120.0100.00714.82
7.3.110.0090.00914.59
7.3.100.0070.01115.15
7.3.90.0060.00915.02
7.3.80.0030.01215.24
7.3.70.0140.00014.97
7.3.60.0110.00314.71
7.3.50.0080.00414.91
7.3.40.0040.01214.86
7.3.30.0090.00614.68
7.3.20.0120.00316.47
7.3.10.0000.01716.65
7.3.00.0070.00716.46
7.2.330.0060.01216.75
7.2.320.0090.00916.85
7.2.310.0090.00916.74
7.2.300.0090.00916.81
7.2.290.0090.01016.79
7.2.250.0140.00315.08
7.2.240.0030.01615.21
7.2.230.0120.00315.00
7.2.220.0070.01015.25
7.2.210.0000.01515.18
7.2.200.0070.00715.09
7.2.190.0050.01015.17
7.2.180.0000.02114.84
7.2.170.0100.00715.15
7.2.160.0090.00615.01
7.2.150.0040.01416.77
7.2.140.0070.01116.93
7.2.130.0070.01117.00
7.2.120.0040.00716.82
7.2.110.0030.00716.77
7.2.100.0060.00917.05
7.2.90.0000.01417.07
7.2.80.0060.00617.07
7.2.70.0040.01216.73
7.2.60.0080.00416.94
7.2.50.0110.00417.03
7.2.40.1400.00917.33
7.2.30.3710.00917.74
7.2.20.4270.01217.44
7.2.10.0060.01217.49
7.2.00.0340.00917.57
7.1.330.0110.00715.89
7.1.320.0040.01215.79
7.1.310.0120.00615.60
7.1.300.0110.00015.94
7.1.290.0100.01015.60
7.1.280.0140.00315.96
7.1.270.0000.01115.82
7.1.260.0030.01015.58
7.1.250.0030.00615.62
7.1.240.0070.00415.80
7.1.230.0090.00615.90
7.1.220.0000.01015.83
7.1.210.0120.00415.94
7.1.200.0060.00615.83
7.1.190.0030.00615.84
7.1.180.0040.00715.91
7.1.170.0090.00015.70
7.1.160.0040.01016.19
7.1.150.0060.01216.46
7.1.140.1500.01216.39
7.1.130.0690.00916.51
7.1.120.0160.01116.30
7.1.110.0220.01116.19
7.1.100.0340.01116.01
7.1.90.0080.00816.18
7.1.80.0070.00815.99
7.1.70.0050.01115.55
7.1.60.1060.01124.41
7.1.50.3200.01424.39
7.1.40.2710.01523.98
7.1.30.2390.01224.19
7.1.20.2530.01124.31
7.1.10.2100.00715.29
7.1.00.2320.01115.37
7.0.330.0060.00615.40
7.0.320.0060.01015.52
7.0.310.0060.00915.10
7.0.300.0040.01115.59
7.0.290.0030.01315.46
7.0.280.0070.01015.58
7.0.270.0040.00715.46
7.0.260.0090.00615.27
7.0.250.0160.00315.48
7.0.240.0100.00415.61
7.0.230.0100.00015.62
7.0.220.0040.01115.46
7.0.210.0100.00315.57
7.0.200.0080.01115.45
7.0.190.0070.00715.31
7.0.180.0000.01015.23
7.0.170.0040.01115.14
7.0.160.0050.00515.54
7.0.150.0060.00615.43
7.0.140.0040.01415.55
7.0.130.0000.01415.36
7.0.120.0090.00315.07
7.0.110.0100.00315.43
7.0.100.0100.00715.43
7.0.90.0120.00615.47
7.0.80.0070.01315.69
7.0.70.0060.01315.57
7.0.60.0000.01715.68
7.0.50.0070.00715.51
7.0.40.0040.00713.51
7.0.30.0120.00413.56
7.0.20.0030.01013.55
7.0.10.0070.01513.63
7.0.00.0120.00413.40
5.6.400.0080.00414.25
5.6.390.0030.00614.25
5.6.380.0000.01213.99
5.6.370.0060.00613.84
5.6.360.0030.00614.38
5.6.350.0070.00314.37
5.6.340.0030.00514.07
5.6.330.0040.00813.97
5.6.320.0060.00314.33
5.6.310.0050.00514.27
5.6.300.0060.00914.16
5.6.290.0040.00814.15
5.6.280.0090.00314.32
5.6.270.0070.01014.20
5.6.260.0030.00614.42
5.6.250.0120.00314.28
5.6.240.0040.00814.35
5.6.230.0100.00714.20
5.6.220.0070.01014.44
5.6.210.0060.00314.19
5.6.200.0110.00313.96
5.6.190.0040.01114.13
5.6.180.0060.00614.25
5.6.170.0060.00914.28
5.6.160.0030.00614.21
5.6.150.0070.00714.14
5.6.140.0070.00714.03
5.6.130.0060.00614.07
5.6.120.0060.00614.21
5.6.110.0120.00614.06
5.6.100.0070.01014.21
5.6.90.0030.01314.05
5.6.80.0060.01014.15
5.6.70.0090.00614.00
5.6.60.0030.01313.83
5.6.50.0030.01314.13
5.6.40.0030.00714.18
5.6.30.0070.00713.91
5.6.20.0000.01513.83
5.6.10.0100.00714.10
5.6.00.0090.00314.05

preferences:
60.43 ms | 400 KiB | 5 Q