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(); var_export(null); } 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.0130.00720.34
8.4.110.0130.00719.50
8.4.100.0140.00717.91
8.4.90.0120.00720.39
8.4.80.0060.00218.58
8.4.70.0070.00418.74
8.4.60.0050.00318.81
8.4.50.0100.01022.47
8.4.40.0150.00618.10
8.4.30.0060.01320.40
8.4.20.0130.00719.84
8.4.10.0060.01319.60
8.3.250.0110.00418.93
8.3.240.0080.01016.60
8.3.230.0050.00316.81
8.3.220.0080.00718.72
8.3.210.0110.00718.44
8.3.200.0100.00516.69
8.3.190.0110.00817.23
8.3.180.0120.00816.57
8.3.170.0100.01016.82
8.3.160.0130.00417.03
8.3.150.0120.00617.29
8.3.140.0080.00018.96
8.3.130.0050.00318.33
8.3.120.0070.00320.75
8.3.110.0070.00320.94
8.3.100.0140.00716.52
8.3.90.0170.00326.77
8.3.80.0080.00020.36
8.3.70.0140.00416.58
8.3.60.0110.00716.63
8.3.50.0040.01118.11
8.3.40.0170.00322.08
8.3.30.0070.00718.79
8.3.20.0040.00424.18
8.3.10.0040.00424.66
8.3.00.0040.00426.16
8.2.290.0090.00716.70
8.2.280.0080.00720.30
8.2.270.0000.01916.75
8.2.260.0000.00816.77
8.2.250.0100.01018.44
8.2.240.0060.00317.25
8.2.230.0060.00322.58
8.2.220.0100.01024.06
8.2.210.0080.00026.77
8.2.200.0030.00616.38
8.2.190.0040.01116.58
8.2.180.0170.00025.92
8.2.170.0110.00319.05
8.2.160.0100.00322.96
8.2.150.0080.00025.66
8.2.140.0040.00424.66
8.2.130.0080.00026.16
8.2.120.0000.00726.16
8.2.110.0040.00722.13
8.2.100.0090.00317.93
8.2.90.0040.00419.36
8.2.80.0080.00017.97
8.2.70.0000.00817.75
8.2.60.0030.00617.78
8.2.50.0000.00818.07
8.2.40.0080.00018.22
8.2.30.0060.00319.66
8.2.20.0000.00720.48
8.2.10.0060.00317.71
8.2.00.0040.00419.34
8.1.330.0120.00816.33
8.1.320.0120.00716.02
8.1.310.0060.00316.10
8.1.300.0060.00317.82
8.1.290.0030.00630.84
8.1.280.0070.01025.92
8.1.270.0000.00823.99
8.1.260.0040.00426.35
8.1.250.0060.00328.09
8.1.240.0050.00522.61
8.1.230.0080.00417.79
8.1.220.0050.00317.74
8.1.210.0000.00818.77
8.1.200.0060.00317.35
8.1.190.0090.00317.25
8.1.180.0040.00418.10
8.1.170.0040.00418.59
8.1.160.0050.00220.17
8.1.150.0050.00318.55
8.1.140.0030.00617.52
8.1.130.0070.00018.93
8.1.120.0000.00917.40
8.1.110.0040.00417.41
8.1.100.0000.00817.38
8.1.90.0040.00417.41
8.1.80.0040.00417.36
8.1.70.0000.00717.49
8.1.60.0000.00817.62
8.1.50.0030.00617.45
8.1.40.0050.00317.51
8.1.30.0000.00817.49
8.1.20.0060.00317.54
8.1.10.0140.00317.45
8.1.00.0250.00317.55
8.0.300.0060.00318.77
8.0.290.0040.00416.75
8.0.280.0040.00418.44
8.0.270.0040.00416.86
8.0.260.0060.00018.48
8.0.250.0030.00316.91
8.0.240.0030.00316.97
8.0.230.0040.00417.02
8.0.220.0000.00716.96
8.0.210.0050.00316.97
8.0.200.0030.00317.04
8.0.190.0000.00817.01
8.0.180.0040.00416.87
8.0.170.0080.00016.98
8.0.160.0030.00416.95
8.0.150.0030.00316.95
8.0.140.0110.01116.89
8.0.130.0150.00616.79
8.0.120.0160.00816.92
8.0.110.0140.00516.91
8.0.100.0110.00716.86
8.0.90.0150.00516.96
8.0.80.0120.00816.77
8.0.70.0140.00516.85
8.0.60.0150.00316.84
8.0.50.0160.00316.92
8.0.30.0110.00716.86
8.0.20.0140.00516.95
8.0.10.0150.00316.95
8.0.00.0060.00617.00
7.4.330.0000.00515.55
7.4.320.0070.00016.55
7.4.300.0040.00416.63
7.4.290.0000.00916.28
7.4.280.0000.00816.59
7.4.270.0240.00016.47
7.4.260.0210.00016.51
7.4.250.0200.00016.55
7.4.240.0120.00816.61
7.4.230.0160.00416.45
7.4.220.0150.00316.61
7.4.210.0150.00316.42
7.4.200.0110.00716.56
7.4.190.0150.00416.41
7.4.180.0130.00516.60
7.4.160.0080.01216.59
7.4.150.0150.00516.45
7.4.140.0180.00516.53
7.4.130.0040.01316.42
7.4.120.0100.01016.36
7.4.110.0160.00416.30
7.4.100.0180.00016.49
7.4.90.0090.00516.57
7.4.80.0050.00516.39
7.4.70.0040.00916.40
7.4.60.0080.00316.41
7.4.50.0110.00016.33
7.4.40.0060.00616.36
7.4.30.0060.00616.33
7.4.20.0040.00816.42
7.4.10.0080.00316.36
7.4.00.0110.00016.50
7.3.330.0070.00516.38
7.3.320.0040.00816.33
7.3.310.0080.00416.22
7.3.300.0030.00916.43
7.3.290.0190.00016.43
7.3.280.0130.00416.32
7.3.270.0130.00516.34
7.3.260.0190.00016.44
7.3.250.0180.00316.51
7.3.240.0100.01016.31
7.3.230.0080.00516.43
7.3.220.0030.01016.34
7.3.210.0060.00716.30
7.3.200.0090.00316.05
7.3.190.0050.00816.36
7.3.180.0140.00316.36
7.3.170.0120.00416.16
7.3.160.0110.00316.24
7.3.150.0110.00516.35
7.3.140.0110.00316.13
7.3.130.0150.00316.36

preferences:
28.59 ms | 403 KiB | 5 Q