3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = array( array( 'name' => 'name', 'label' => 'Label' ), array( 'name' => 'name', 'label' => 'Label', 'sub_fields' => array( array( 'name' => 'my_desired_target', 'label' => 'Label' ) ) ) ); function change_recursively($arr, $previous){ foreach($arr as $key => &$val){ if(is_array($val)){ If($previous == NULL){ change_recursively($val, $key); }Else{ change_recursively($val, $previous . "," .$key); } }else{ if($key == 'name' && $val == 'my_desired_target'){ $path =explode(",", $previous); Var_dump($path); //How to add new key here? $arr['new_key'] = 'my new value'; } } } } change_recursively($arr, NULL); Var_dump($arr);

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.30.0090.00819.34
8.5.20.0070.00918.54
8.5.10.0130.00516.82
8.5.00.0090.01320.02
8.4.180.0150.00919.68
8.4.170.0140.00723.92
8.4.160.0050.00523.98
8.4.150.0070.00616.88
8.4.140.0180.01217.71
8.4.130.0070.00217.80
8.4.120.0150.00520.59
8.4.110.0110.01018.69
8.4.100.0130.00817.71
8.4.90.0120.00820.41
8.4.80.0060.00318.88
8.4.70.0100.00922.04
8.4.60.0100.01118.79
8.4.50.0110.00820.36
8.4.40.0110.00017.59
8.4.30.0100.01019.46
8.4.20.0100.01019.47
8.4.10.0100.00719.73
8.3.300.0080.01219.02
8.3.290.0140.00620.74
8.3.280.0120.01320.72
8.3.270.0140.00516.61
8.3.260.0140.00616.63
8.3.250.0120.00518.64
8.3.240.0130.00716.76
8.3.230.0090.01016.42
8.3.220.0120.00718.94
8.3.210.0100.00616.85
8.3.200.0050.00416.52
8.3.190.0120.01017.30
8.3.180.0100.00816.82
8.3.170.0040.00418.32
8.3.160.0110.00718.17
8.3.150.0140.00320.75
8.3.140.0000.00918.29
8.3.130.0080.00016.69
8.3.120.0100.01018.88
8.3.110.0120.00020.94
8.3.100.0120.00324.06
8.3.90.0030.00518.26
8.3.80.0000.00918.30
8.3.70.0110.00718.43
8.3.60.0060.01218.43
8.3.50.0120.00817.29
8.3.40.0100.00718.66
8.3.30.0110.00418.85
8.3.20.0080.00020.30
8.3.10.0040.00420.82
8.3.00.0000.00821.00
8.2.300.0100.01122.19
8.2.290.0040.00817.01
8.2.280.0120.00718.62
8.2.270.0100.01019.05
8.2.260.0140.00418.27
8.2.250.0040.01116.68
8.2.240.0040.00419.03
8.2.230.0140.00322.58
8.2.220.0100.00637.54
8.2.210.0060.01226.77
8.2.200.0080.00416.50
8.2.190.0150.00416.58
8.2.180.0180.00418.34
8.2.170.0060.00922.96
8.2.160.0100.00720.39
8.2.150.0070.00724.18
8.2.140.0080.00024.66
8.2.130.0120.00326.16
8.2.120.0080.00019.82
8.2.110.0050.00520.51
8.2.100.0110.00017.75
8.2.90.0030.00519.23
8.2.80.0000.00817.97
8.2.70.0030.00617.63
8.2.60.0040.00418.03
8.2.50.0040.00418.07
8.2.40.0000.00818.32
8.2.30.0040.00418.16
8.2.20.0000.00718.21
8.2.10.0080.00018.15
8.2.00.0000.00718.13
8.1.340.0090.01117.62
8.1.330.0050.00416.35
8.1.320.0100.00920.05
8.1.310.0040.00417.05
8.1.300.0030.00618.69
8.1.290.0000.01018.88
8.1.280.0140.00725.92
8.1.270.0060.00320.63
8.1.260.0080.00026.35
8.1.250.0000.00728.09
8.1.240.0090.01223.98
8.1.230.0090.00317.82
8.1.220.0040.00417.79
8.1.210.0060.00318.77
8.1.200.0060.00317.35
8.1.190.0050.00317.35
8.1.180.0030.00618.10
8.1.170.0030.00618.46
8.1.160.0000.00818.96
8.1.150.0040.00418.91
8.1.140.0070.00019.63
8.1.130.0000.00818.82
8.1.120.0030.00517.53
8.1.110.0040.00417.50
8.1.100.0080.00017.55
8.1.90.0050.00317.53
8.1.80.0040.00417.37
8.1.70.0030.00317.46
8.1.60.0030.00617.61
8.1.50.0040.00417.57
8.1.40.0000.00817.40
8.1.30.0080.00017.64
8.1.20.0070.00017.68
8.1.10.0030.00517.64
8.1.00.0050.00217.56
8.0.300.0030.00518.77
8.0.290.0000.00816.63
8.0.280.0030.00318.47
8.0.270.0050.00317.26
8.0.260.0000.00820.73
8.0.250.0000.00816.86
8.0.240.0050.00316.95
8.0.230.0000.00716.95
8.0.220.0000.00716.88
8.0.210.0000.00816.91
8.0.200.0030.00316.86
8.0.190.0090.00016.87
8.0.180.0030.00516.86
8.0.170.0040.00416.88
8.0.160.0020.00516.88
8.0.150.0040.00416.94
8.0.140.0000.00716.76
8.0.130.0030.00313.34
8.0.120.0000.00816.82
8.0.110.0020.00516.91
8.0.100.0040.00416.76
8.0.90.0040.00416.95
8.0.80.0040.01516.96
8.0.70.0000.00716.96
8.0.60.0050.00216.95
8.0.50.0040.00416.95
8.0.30.0060.01217.01
8.0.20.0100.00917.40
8.0.10.0050.00316.91
8.0.00.0110.00716.89
7.4.330.0050.00015.55
7.4.320.0030.00316.61
7.4.300.0000.00616.52
7.4.290.0030.00316.48
7.4.280.0050.00316.56
7.4.270.0030.00516.58
7.4.260.0070.00016.48
7.4.250.0030.00316.59
7.4.240.0040.00416.59
7.4.230.0040.00416.55
7.4.220.0090.01016.41
7.4.210.0080.00716.53
7.4.200.0000.00716.41
7.4.160.0120.00816.60
7.4.150.0150.00317.40
7.4.140.0080.01017.86
7.4.130.0170.00816.34
7.4.120.0140.00716.55
7.4.110.0050.01216.59
7.4.100.0210.00816.41
7.4.90.0120.00916.53
7.4.80.0150.00619.39
7.4.70.0080.01116.61
7.4.60.0080.00816.48
7.4.50.0030.00916.56
7.4.40.0060.01116.32
7.4.30.0140.00316.48
7.4.00.0030.00714.96
7.3.330.0000.00513.28
7.3.320.0000.00613.33
7.3.310.0000.00716.27
7.3.300.0030.00316.25
7.3.290.0090.00616.40
7.3.280.0080.00916.34
7.3.270.0100.01017.40
7.3.260.0100.00816.49
7.3.250.0070.01316.54
7.3.240.0100.00816.50
7.3.230.0100.01016.66
7.3.210.0060.01016.56
7.3.200.0100.01316.31
7.3.190.0130.00616.45
7.3.180.0060.01216.41
7.3.170.0140.00716.30
7.3.160.0090.00616.30
7.2.330.0100.00716.68
7.2.320.0030.01616.63
7.2.310.0030.02016.79
7.2.300.0070.01316.52
7.2.290.0070.01016.76
7.2.60.0030.01016.86
7.1.200.0040.01115.77
7.1.70.0090.00317.33
7.1.60.0260.00035.16
7.1.50.0100.01734.48
7.1.40.0200.00734.29
7.1.30.0130.01334.44
7.1.20.0180.00934.57
7.1.10.0090.00316.45
7.1.00.0030.01016.57
7.0.200.0090.00316.93
7.0.190.0060.00616.79
7.0.180.0000.01116.20
7.0.170.0070.00716.23
7.0.160.0050.00816.32
7.0.150.0000.01216.05
7.0.140.0030.01016.39
7.0.130.0030.00916.69
7.0.120.0090.00316.43
7.0.110.0030.01116.11
7.0.100.0030.01016.38
7.0.90.0040.00816.55
7.0.80.0030.01216.16
7.0.70.0040.00816.35
7.0.60.0090.00316.30
7.0.50.0040.00816.57
7.0.40.0040.01016.38
7.0.30.0070.00716.51
7.0.20.0080.00416.47
7.0.10.0030.00916.49
7.0.00.0060.00616.18

preferences:
46.16 ms | 1580 KiB | 5 Q