3v4l.org

run code in 300+ PHP versions simultaneously
<?php $input = [ 'firstName' => null, 'lastName' => null, 'category' => [ 'name' => null, 'service' => [ 'foo' => [ 'bar' => null ] ] ] ]; function prepareFields(array $array): array { return array_reduce(array_keys($array), function ($result, $key) use ($array) { $result[] = $key; if (is_array($array[$key])) { $result[$key] = prepareFields($array[$key]); } return $result; }); } print_r(prepareFields($input));

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.5.10.0080.00916.67
8.5.00.0140.01320.05
8.4.150.0020.00114.05
8.4.140.0140.00717.59
8.4.130.0100.01017.86
8.4.120.0050.00524.26
8.4.110.0120.00822.66
8.4.100.0120.00917.76
8.4.90.0040.00518.68
8.4.80.0080.00417.84
8.4.70.0070.01217.83
8.4.60.0040.00718.81
8.4.50.0120.00720.36
8.4.40.0090.00017.59
8.4.30.0090.01018.59
8.4.20.0070.01318.70
8.4.10.0030.00617.67
8.3.280.0120.00918.50
8.3.270.0130.00816.54
8.3.260.0120.00816.81
8.3.250.0120.00719.09
8.3.240.0120.00617.05
8.3.230.0120.00716.64
8.3.220.0150.00318.98
8.3.210.0100.00916.73
8.3.200.0050.00316.57
8.3.190.0130.00817.26
8.3.180.0100.00616.54
8.3.170.0070.01119.04
8.3.160.0060.01217.41
8.3.150.0110.00717.20
8.3.140.0100.01016.83
8.3.130.0060.00316.55
8.3.120.0060.00320.97
8.3.110.0040.00416.53
8.3.100.0090.00016.56
8.3.90.0140.00026.77
8.3.80.0030.00616.50
8.3.70.0070.01116.58
8.3.60.0080.00816.75
8.3.50.0120.00316.61
8.3.40.0180.00419.00
8.3.30.0120.00318.68
8.3.20.0040.00421.55
8.3.10.0040.00421.71
8.3.00.0080.00022.33
8.2.290.0130.00620.20
8.2.280.0100.00218.50
8.2.270.0070.01019.11
8.2.260.0110.00417.11
8.2.250.0000.01618.41
8.2.240.0000.00817.17
8.2.230.0030.00620.94
8.2.220.0130.00324.06
8.2.210.0000.00826.77
8.2.200.0040.00416.50
8.2.190.0130.01016.58
8.2.180.0130.00725.92
8.2.170.0140.00318.95
8.2.160.0150.00419.41
8.2.150.0060.00324.18
8.2.140.0000.00824.66
8.2.130.0080.00026.16
8.2.120.0080.00026.16
8.2.110.0080.00321.10
8.2.100.0040.00717.91
8.2.90.0080.00018.24
8.2.80.0040.00717.97
8.2.70.0080.00018.05
8.2.60.0000.00918.15
8.2.50.0050.00318.10
8.2.40.0060.00319.33
8.2.30.0040.00419.30
8.2.20.0000.00718.00
8.2.10.0040.00419.31
8.2.00.0000.00819.23
8.1.330.0130.00621.57
8.1.320.0100.00816.23
8.1.310.0100.00718.38
8.1.300.0030.00618.34
8.1.290.0030.00630.84
8.1.280.0080.00825.92
8.1.270.0040.00422.54
8.1.260.0050.00226.35
8.1.250.0050.00328.09
8.1.240.0060.00321.36
8.1.230.0080.00422.81
8.1.220.0000.00917.79
8.1.210.0050.00318.77
8.1.200.0070.00317.35
8.1.190.0030.00617.23
8.1.180.0060.00318.10
8.1.170.0000.00818.50
8.1.160.0090.00018.92
8.1.150.0040.00418.83
8.1.140.0000.00720.81
8.1.130.0020.00517.46
8.1.120.0030.00317.51
8.1.110.0030.00417.50
8.1.100.0000.00717.38
8.1.90.0040.00417.37
8.1.80.0080.00417.47
8.1.70.0000.00717.33
8.1.60.0000.00817.56
8.1.50.0050.00317.55
8.1.40.0040.00417.53
8.1.30.0070.00317.50
8.1.20.0040.00417.65
8.1.10.0070.00017.58
8.1.00.0030.00617.40
8.0.300.0000.00719.84
8.0.290.0000.00716.63
8.0.280.0040.00418.43
8.0.270.0080.00017.25
8.0.260.0030.00516.86
8.0.250.0030.00316.95
8.0.240.0000.00616.84
8.0.230.0000.00716.92
8.0.220.0030.00316.86
8.0.210.0040.00416.91
8.0.200.0030.00316.98
8.0.190.0030.00417.01
8.0.180.0040.00816.81
8.0.170.0080.00316.89
8.0.160.0040.00416.84
8.0.150.0030.00516.81
8.0.140.0000.00916.73
8.0.130.0000.00613.28
8.0.120.0040.00416.87
8.0.110.0000.00716.73
8.0.100.0050.00316.86
8.0.90.0000.00916.76
8.0.80.0110.00416.79
8.0.70.0030.00516.68
8.0.60.0040.00416.75
8.0.50.0000.00816.92
8.0.30.0040.01217.00
8.0.20.0100.01016.75
8.0.10.0050.00316.99
8.0.00.0090.00916.62
7.4.330.0060.00015.55
7.4.320.0060.00016.57
7.4.300.0060.00016.61
7.4.290.0000.00816.50
7.4.280.0040.00416.61
7.4.270.0000.00716.51
7.4.260.0000.00513.26
7.4.250.0070.00016.38
7.4.240.0080.00016.61
7.4.230.0070.00016.57
7.4.220.0020.00516.52
7.4.210.0080.00816.46
7.4.200.0040.00416.33
7.4.130.0180.00616.33
7.4.120.0120.00816.45
7.4.110.0070.01016.29
7.4.100.0130.01216.44
7.4.90.0160.00616.58
7.4.80.0170.00619.39
7.4.70.0090.00616.38
7.4.60.0060.01116.57
7.4.50.0070.01016.55
7.4.40.0160.00616.39
7.4.00.0070.00715.03
7.3.330.0030.00316.23
7.3.320.0050.00013.20
7.3.310.0050.00216.21
7.3.300.0000.00616.24
7.3.290.0090.00516.38
7.3.260.0110.00716.41
7.3.240.0070.01016.48
7.3.230.0140.00316.51
7.3.210.0100.00716.59
7.3.200.0060.01516.48
7.3.190.0140.00416.43
7.3.180.0090.00916.50
7.3.170.0090.00916.62
7.3.160.0080.00816.54
7.3.90.0090.00614.89
7.3.80.0130.00615.02
7.3.70.0050.00814.91
7.3.60.0110.00314.94
7.3.50.0060.00914.82
7.3.40.0000.02014.87
7.3.30.0110.00714.82
7.3.20.0070.01214.82
7.3.10.0120.00614.91
7.3.00.0120.00914.78
7.2.330.0170.00016.69
7.2.320.0110.00616.47
7.2.310.0130.00316.70
7.2.300.0130.00316.51
7.2.290.0050.01116.58
7.2.220.0030.01114.82
7.2.210.0100.00714.80
7.2.200.0060.00915.09
7.2.190.0060.00915.11
7.2.180.0000.01514.95
7.2.170.0060.01315.12
7.2.160.0170.00315.17
7.2.150.0140.00615.10
7.2.140.0140.00315.28
7.2.130.0120.00915.11
7.2.120.0080.00815.14
7.2.110.0070.01015.04
7.2.100.0040.01314.98
7.2.90.0070.01014.95
7.2.80.0110.00714.86
7.2.70.0150.00315.11
7.2.60.0140.00615.21
7.2.50.0060.01214.88
7.2.40.0160.00715.08
7.2.30.0090.00915.11
7.2.20.0130.00515.01
7.2.10.0140.00315.10
7.2.00.0110.00614.96
7.1.320.0070.00713.88
7.1.310.0030.01214.05
7.1.300.0110.00414.02
7.1.290.0090.00613.79
7.1.280.0090.00613.91
7.1.270.0070.01414.17
7.1.260.0100.01014.22
7.1.250.0150.00313.91

preferences:
40.69 ms | 403 KiB | 5 Q