3v4l.org

run code in 300+ PHP versions simultaneously
<?php $input = [ 1 => ['Hello' => 'this is a nested hello!'], 'Hello' => 'this is a root hello!']; function getValue($root, $i = null) { $_t = isset($root[$i]) ? $root[$i] : $root; return isset($_t['Hello']) ? $_t['Hello'] : ''; } echo getValue($input); echo getValue($input, 1); echo getValue($input, 2);

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.01216.75
8.3.50.0140.00721.98
8.3.40.0160.00618.84
8.3.30.0120.00318.71
8.3.20.0080.00021.80
8.3.10.0040.00418.62
8.3.00.0000.00721.90
8.2.180.0110.00725.92
8.2.170.0160.00319.08
8.2.160.0120.00622.96
8.2.150.0000.00825.66
8.2.140.0040.00424.66
8.2.130.0070.00020.89
8.2.120.0080.00026.35
8.2.110.0030.00722.11
8.2.100.0060.00617.91
8.2.90.0000.00818.05
8.2.80.0050.00318.05
8.2.70.0060.00318.05
8.2.60.0000.00918.16
8.2.50.0090.00018.10
8.2.40.0040.00420.53
8.2.30.0040.00419.39
8.2.20.0070.00018.13
8.2.10.0000.00717.97
8.2.00.0080.00017.60
8.1.280.0090.00925.92
8.1.270.0090.00623.83
8.1.260.0090.00028.09
8.1.250.0050.00228.09
8.1.240.0030.00622.14
8.1.230.0030.01019.04
8.1.220.0040.00417.74
8.1.210.0040.00418.77
8.1.200.0000.00817.23
8.1.190.0000.00817.23
8.1.180.0090.00018.10
8.1.170.0000.00819.06
8.1.160.0040.00422.22
8.1.150.0070.00018.89
8.1.140.0040.00419.39
8.1.130.0000.00817.74
8.1.120.0000.00717.41
8.1.110.0000.00817.44
8.1.100.0020.00517.41
8.1.90.0020.00517.46
8.1.80.0070.00017.32
8.1.70.0030.00317.46
8.1.60.0050.00317.57
8.1.50.0060.00317.41
8.1.40.0040.00417.57
8.1.30.0040.00417.65
8.1.20.0070.00017.62
8.1.10.0000.00817.55
8.1.00.0000.01017.46
8.0.300.0000.00719.60
8.0.290.0050.00216.63
8.0.280.0030.00318.35
8.0.270.0030.00317.22
8.0.260.0060.00017.38
8.0.250.0030.00316.86
8.0.240.0060.00016.84
8.0.230.0000.00816.82
8.0.220.0000.00716.82
8.0.210.0030.00316.83
8.0.200.0000.00616.92
8.0.190.0030.00516.88
8.0.180.0040.00416.86
8.0.170.0000.00916.78
8.0.160.0000.00916.73
8.0.150.0000.00716.80
8.0.140.0000.00816.80
8.0.130.0050.00013.35
8.0.120.0080.00016.70
8.0.110.0040.00416.72
8.0.100.0040.00416.89
8.0.90.0050.00216.72
8.0.80.0130.00716.74
8.0.70.0090.00016.69
8.0.60.0000.00716.66
8.0.50.0000.00716.80
8.0.30.0110.00817.12
8.0.20.0090.01017.40
8.0.10.0020.00516.96
8.0.00.0090.00916.42
7.4.330.0050.00015.21
7.4.320.0060.00016.47
7.4.300.0030.00316.41
7.4.290.0030.00616.64
7.4.280.0040.00416.55
7.4.270.0050.00316.45
7.4.260.0040.00416.46
7.4.250.0040.00416.51
7.4.240.0030.00316.61
7.4.230.0030.00316.54
7.4.220.0060.01016.59
7.4.210.0070.01416.61
7.4.200.0000.00716.39
7.4.160.0130.00316.61
7.4.150.0100.00717.40
7.4.140.0090.00917.86
7.4.130.0130.00616.65
7.4.120.0080.00916.55
7.4.110.0110.00716.59
7.4.100.0030.01416.50
7.4.90.0110.00716.52
7.4.80.0100.01019.39
7.4.70.0080.00816.59
7.4.60.0100.00716.41
7.4.50.0100.00716.23
7.4.40.0090.00616.45
7.4.30.0000.01516.49
7.4.00.0040.00814.92
7.3.330.0000.00513.29
7.3.320.0050.00013.35
7.3.310.0000.00716.32
7.3.300.0040.00416.34
7.3.290.0090.00516.26
7.3.280.0110.00716.30
7.3.270.0130.00317.40
7.3.260.0070.01116.40
7.3.250.0100.00716.47
7.3.240.0150.00716.34
7.3.230.0180.00316.58
7.3.210.0030.01316.40
7.3.200.0030.01316.37
7.3.190.0060.01116.38
7.3.180.0040.01416.39
7.3.170.0060.01016.51
7.3.160.0060.01016.50
7.3.120.0000.01514.79
7.3.110.0030.01315.08
7.3.100.0040.01114.94
7.3.90.0000.01515.03
7.3.80.0090.00614.90
7.3.70.0000.01614.93
7.3.60.0030.01014.91
7.3.50.0060.00914.76
7.3.40.0030.01214.85
7.3.30.0030.00914.72
7.3.20.0000.01116.64
7.3.10.0060.00616.69
7.3.00.0060.00616.85
7.2.330.0100.00716.58
7.2.320.0030.01316.60
7.2.310.0060.01016.44
7.2.300.0100.01316.57
7.2.290.0130.00316.47
7.2.250.0060.01014.83
7.2.240.0070.01415.25
7.2.230.0130.00315.17
7.2.220.0070.01015.07
7.2.210.0030.01315.18
7.2.200.0060.01015.10
7.2.190.0040.01115.02
7.2.180.0030.00715.02
7.2.170.0060.00914.91
7.2.60.0110.00416.95
7.2.00.0030.00919.11
7.1.330.0070.00715.82
7.1.320.0100.00315.99
7.1.310.0110.00315.89
7.1.300.0030.01015.99
7.1.290.0070.00315.99
7.1.280.0040.01215.73
7.1.270.0030.00615.85
7.1.260.0090.00615.90
7.1.200.0040.00715.81
7.1.70.0000.01017.22
7.1.60.0040.00717.25
7.1.00.0170.06322.28
7.0.200.0090.00314.77
7.0.110.0070.06320.14
7.0.100.0030.06320.23
7.0.90.0130.05720.28
7.0.80.0130.05320.23
7.0.70.0000.07020.38
7.0.60.0000.06720.38
7.0.50.0030.06720.28
7.0.40.0370.05020.22
7.0.30.0300.06020.18
7.0.20.0470.07020.31
7.0.10.0470.06320.30
7.0.00.0400.06720.30
5.6.260.0130.05721.13
5.6.250.0100.05720.89
5.6.240.0030.06721.02
5.6.230.0100.06021.09
5.6.220.0130.05320.92
5.6.210.0230.06720.95
5.6.200.0130.07320.95
5.6.190.0130.05720.83
5.6.180.0230.06720.86
5.6.170.0030.06321.09
5.6.160.0130.05021.00
5.6.150.0070.06320.83
5.6.140.0100.06021.00
5.6.130.0070.06321.05
5.6.120.0100.06020.82
5.6.110.0230.06320.98
5.6.100.0200.05320.74
5.6.90.0100.07721.01
5.6.80.0070.05320.19
5.6.70.0200.04320.31
5.6.60.0100.05320.45
5.6.50.0230.07320.38
5.6.40.0000.06320.36
5.6.30.0070.09020.16
5.6.20.0070.09020.30
5.6.10.0130.05320.11
5.6.00.0270.04320.16

preferences:
51.98 ms | 401 KiB | 5 Q