3v4l.org

run code in 300+ PHP versions simultaneously
<?php function get_array_deep_value(array $array, array $levelKeys) { foreach ($levelKeys as $index => $key) { if (!key_exists($key, $array)) { throw new Exception("key $key not found at level index $index"); } $array = $array[$key]; } return $array; } $myArray = [ 'one' => [ 'two' => [ 'three' => [ 4 ] ] ] ]; $pathArrays = [ ['one', 'two', 'three'], ['one', 'two'], ['one'], ['two'] ]; foreach ($pathArrays as $pathArray) { try { var_export(get_array_deep_value($myArray, $pathArray)); } catch (Exception$e) { echo $e->getMessage(); } echo "\n---\n"; }

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.120.0080.01120.62
8.4.110.0140.00618.72
8.4.100.0110.01017.96
8.4.90.0130.00818.90
8.4.80.0070.00219.80
8.4.70.0090.00918.11
8.4.60.0140.00719.02
8.4.50.0120.00819.79
8.4.40.0130.00617.61
8.4.30.0120.00920.55
8.4.20.0100.01017.71
8.4.10.0080.00819.36
8.3.250.0120.00718.80
8.3.240.0080.01116.56
8.3.230.0120.00616.66
8.3.220.0080.01117.30
8.3.210.0090.00516.45
8.3.200.0030.00616.58
8.3.190.0100.00419.11
8.3.180.0080.00216.79
8.3.170.0090.00920.53
8.3.160.0060.01318.50
8.3.150.0120.00620.91
8.3.140.0080.00016.89
8.3.130.0030.00518.68
8.3.120.0040.01516.39
8.3.110.0090.00018.41
8.3.100.0030.00618.48
8.3.90.0040.00426.77
8.3.80.0090.00316.50
8.3.70.0150.00016.62
8.3.60.0150.00616.50
8.3.50.0140.00018.39
8.3.40.0110.00421.87
8.3.30.0140.00418.56
8.3.20.0080.00024.18
8.3.10.0040.00424.66
8.3.00.0050.00226.16
8.2.290.0140.00616.55
8.2.280.0100.00918.54
8.2.270.0080.01117.44
8.2.260.0040.01118.91
8.2.250.0050.00318.28
8.2.240.0070.00317.37
8.2.230.0000.00820.94
8.2.220.0030.00624.06
8.2.210.0030.00526.77
8.2.200.0090.00016.63
8.2.190.0120.00316.75
8.2.180.0190.01025.92
8.2.170.0140.00419.05
8.2.160.0070.00722.96
8.2.150.0000.00725.66
8.2.140.0030.00624.66
8.2.130.0040.00426.16
8.2.120.0070.00026.16
8.2.110.0090.00022.26
8.2.100.0060.00619.70
8.2.90.0040.00418.09
8.2.80.0000.00819.23
8.2.70.0040.00417.63
8.2.60.0000.00817.63
8.2.50.0050.00317.98
8.2.40.0040.00418.28
8.2.30.0030.00517.93
8.2.20.0070.00020.44
8.2.10.0040.00417.74
8.2.00.0040.00419.37
8.1.330.0100.01116.32
8.1.320.0110.01016.09
8.1.310.0030.00518.67
8.1.300.0030.00618.13
8.1.290.0030.00730.84
8.1.280.0150.00625.92
8.1.270.0000.00923.91
8.1.260.0070.00026.35
8.1.250.0040.00428.09
8.1.240.0060.00323.91
8.1.230.0070.00422.82
8.1.220.0030.00517.74
8.1.210.0050.00318.77
8.1.200.0100.00317.35
8.1.190.0040.00417.13
8.1.180.0040.00418.10
8.1.170.0080.00017.62
8.1.160.0000.00720.28
8.1.150.0000.00818.57
8.1.140.0030.00617.50
8.1.130.0030.00318.89
8.1.120.0040.00417.46
8.1.110.0080.00017.46
8.1.100.0050.00317.35
8.1.90.0050.00317.45
8.1.80.0000.00817.37
8.1.70.0070.00017.36
8.1.60.0060.00317.48
8.1.50.0090.00017.55
8.1.40.0000.00717.39
8.1.30.0030.00617.59
8.1.20.0030.00617.56
8.1.10.0250.00317.59
8.1.00.0250.00017.43
8.0.300.0050.00220.16
8.0.290.0090.00016.88
8.0.280.0050.00318.48
8.0.270.0030.00316.82
8.0.260.0040.00418.44
8.0.250.0030.00317.04
8.0.240.0030.00317.13
8.0.230.0030.00317.00
8.0.220.0070.00016.84
8.0.210.0070.00016.86
8.0.200.0030.00317.02
8.0.190.0050.00216.97
8.0.180.0060.00317.05
8.0.170.0040.00417.00
8.0.160.0040.00416.88
8.0.150.0000.00816.88
8.0.140.0170.00316.87
8.0.130.0210.00017.02
8.0.120.0180.00516.94
8.0.110.0210.00016.93
8.0.100.0210.00016.95
8.0.90.0130.00916.97
8.0.80.0060.01516.79
8.0.70.0140.00516.93
8.0.60.0140.00916.84
8.0.50.0090.01316.84
8.0.30.0220.00016.91
8.0.20.0130.00817.02
8.0.10.0150.00717.07
8.0.00.0110.00017.14
7.4.330.0030.00315.55
7.4.320.0030.00316.66
7.4.300.0000.00616.50
7.4.290.0000.00716.46
7.4.280.0000.00816.52
7.4.270.0220.00016.60
7.4.260.0190.00316.49
7.4.250.0220.00316.60
7.4.240.0230.00016.45
7.4.230.0170.00716.54
7.4.220.0180.00316.61
7.4.210.0140.00916.52
7.4.200.0200.00016.54
7.4.190.0150.00516.65
7.4.180.0170.00416.60
7.4.160.0150.00516.52
7.4.150.0100.01016.49
7.4.140.0110.00816.46
7.4.130.0170.00316.30
7.4.120.0150.00516.38
7.4.110.0160.00516.44
7.4.100.0070.01416.56
7.4.90.0180.00416.52
7.4.80.0160.00516.38
7.4.70.0100.01016.43
7.4.60.0120.00716.44
7.4.50.0190.00016.17
7.4.40.0130.00416.28
7.4.30.0130.00816.46
7.4.20.0170.00416.45
7.4.10.0210.00016.43
7.4.00.0150.00716.48
7.3.330.0210.00416.41
7.3.320.0270.00316.38
7.3.310.0180.00316.36
7.3.300.0160.00716.21
7.3.290.0160.00516.48
7.3.280.0170.00316.45
7.3.270.0140.00616.28
7.3.260.0190.00016.51
7.3.250.0160.00516.44
7.3.240.0100.01016.39
7.3.230.0200.00316.39
7.3.220.0220.00016.13
7.3.210.0130.00716.32
7.3.200.0170.00416.34
7.3.190.0130.00716.26
7.3.180.0130.00616.25
7.3.170.0140.00716.38
7.3.160.0170.00416.22
7.3.150.0160.00516.37
7.3.140.0150.00716.42
7.3.130.0180.00616.25

preferences:
27.23 ms | 403 KiB | 5 Q