3v4l.org

run code in 300+ PHP versions simultaneously
<?php function appendToValues(&$array, $value) { foreach ($array as &$item) { if ($item['attribute_code'] === 'harddisk') { $item['attribute_value'][] = $value; } elseif(is_array($item['attribute_value'])) { appendToValues($item['attribute_value'], $value); } } } $array = [ 3 => [ 'attribute_code' => 'category', 'attribute_value' => [ 4 => [ 'attribute_code' => 'hardware', 'attribute_value' => [ 5 => [ 'attribute_code' => 'harddisk', 'attribute_value' => [ 6 => [ 'attribute_code' => 'small', 'attribute_value' => '132gb', ], ], ], ], ], ], ], ]; var_dump($array); appendToValues($array, ['attribute_code' => 'medium', 'attribute_value' => '256gb']); var_dump($array);

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.00.0110.01119.67
8.4.150.0020.00014.05
8.4.140.0140.00717.84
8.4.130.0030.00719.01
8.4.120.0110.00924.21
8.4.110.0140.00720.38
8.4.100.0070.00218.89
8.4.90.0100.01122.07
8.4.80.0160.00619.03
8.4.70.0050.00417.84
8.4.60.0050.00618.73
8.4.50.0100.01117.73
8.4.40.0030.00617.59
8.4.30.0060.01320.43
8.4.20.0100.00717.90
8.4.10.0060.00317.59
8.3.280.0140.00618.35
8.3.270.0140.00616.66
8.3.260.0130.00716.62
8.3.250.0120.00719.24
8.3.240.0120.00817.13
8.3.230.0120.00716.55
8.3.220.0100.00719.16
8.3.210.0090.00218.63
8.3.200.0080.00116.51
8.3.190.0090.00617.27
8.3.180.0120.00818.35
8.3.170.0060.01019.14
8.3.160.0060.00318.29
8.3.150.0090.00019.11
8.3.140.0110.00717.05
8.3.130.0100.01018.48
8.3.120.0100.00018.75
8.3.110.0080.00016.63
8.3.100.0070.00316.71
8.3.90.0080.00026.77
8.3.80.0000.01418.49
8.3.70.0080.01116.58
8.3.60.0150.00016.50
8.3.50.0040.01118.23
8.3.40.0070.00720.34
8.3.30.0200.00718.58
8.3.20.0040.00424.18
8.3.10.0070.00024.66
8.3.00.0000.00826.16
8.2.290.0100.00920.36
8.2.280.0110.01018.55
8.2.270.0150.00418.95
8.2.260.0040.00418.75
8.2.250.0050.00318.62
8.2.240.0000.00918.18
8.2.230.0040.00420.94
8.2.220.0000.00924.06
8.2.210.0080.00026.77
8.2.200.0070.00316.88
8.2.190.0140.00416.58
8.2.180.0120.00325.92
8.2.170.0110.00719.04
8.2.160.0120.00322.96
8.2.150.0000.00725.66
8.2.140.0040.00424.66
8.2.130.0030.00526.16
8.2.120.0070.00020.93
8.2.110.0110.00521.58
8.2.100.0060.00617.59
8.2.90.0000.00818.30
8.2.80.0060.00317.97
8.2.70.0030.00618.05
8.2.60.0100.00019.88
8.2.50.0060.00318.10
8.2.40.0040.00421.23
8.2.30.0000.00918.05
8.2.20.0000.00720.42
8.2.10.0040.00417.69
8.2.00.0040.00419.32
8.1.330.0070.00421.90
8.1.320.0090.01015.96
8.1.310.0160.00716.88
8.1.300.0040.00416.22
8.1.290.0060.00330.84
8.1.280.0120.00625.92
8.1.270.0080.00023.77
8.1.260.0080.00026.35
8.1.250.0080.00028.09
8.1.240.0040.00723.77
8.1.230.0110.00023.98
8.1.220.0050.00317.74
8.1.210.0030.00518.95
8.1.200.0000.01017.48
8.1.190.0050.00317.35
8.1.180.0040.00418.10
8.1.170.0000.00918.46
8.1.160.0000.00718.89
8.1.150.0000.00818.70
8.1.140.0040.00417.36
8.1.130.0070.00018.93
8.1.120.0080.00017.51
8.1.110.0050.00317.42
8.1.100.0000.00817.36
8.1.90.0000.00717.50
8.1.80.0060.00517.51
8.1.70.0030.00317.48
8.1.60.0040.00417.62
8.1.50.0040.00417.50
8.1.40.0050.00317.50
8.1.30.0040.00417.48
8.1.20.0050.00317.55
8.1.10.0000.00817.55
8.1.00.0050.00317.52
8.0.300.0000.00819.60
8.0.290.0040.00416.75
8.0.280.0000.00720.22
8.0.270.0030.00316.85
8.0.260.0030.00318.45
8.0.250.0000.00716.97
8.0.240.0030.00316.95
8.0.230.0040.00416.96
8.0.220.0030.00316.84
8.0.210.0070.00016.89
8.0.200.0000.00716.82
8.0.190.0030.00616.92
8.0.180.0040.00416.82
8.0.170.0040.00416.88
8.0.160.0070.00016.88
8.0.150.0040.00416.75
8.0.140.0000.00716.82
8.0.130.0050.00216.76
8.0.120.0040.00416.89
8.0.110.0040.00416.82
8.0.100.0000.00716.85
8.0.90.0040.00416.79
8.0.80.0070.00016.80
8.0.70.0040.00416.75
8.0.60.0040.00416.90
8.0.50.0000.00716.76
8.0.30.0000.00716.89
8.0.20.0000.00816.88
8.0.10.0040.00416.91
7.4.330.0050.00015.55
7.4.320.0060.00316.50
7.4.300.0060.00016.53
7.4.290.0030.00316.45
7.4.280.0040.00416.39
7.4.270.0000.00716.34
7.4.260.0030.00316.49
7.4.250.0070.00016.54
7.4.240.0040.00416.48
7.4.230.0000.00816.58
7.4.220.0060.00316.47
7.4.210.0040.00416.65
7.4.200.0050.00316.56
7.4.190.0000.00816.54
7.4.180.0030.00716.67
7.4.160.0040.00416.46
7.4.150.0040.00416.38
7.4.140.0030.00316.39
7.4.130.0000.00816.44
7.4.120.0050.00216.20
7.4.110.0000.00816.41
7.4.100.0000.00716.44
7.4.90.0000.00816.17
7.4.80.0000.00816.19
7.4.70.0040.00416.22
7.4.60.0000.00716.48
7.4.50.0080.00016.41
7.4.40.0030.00316.42
7.4.30.0000.00716.33
7.4.20.0000.00716.42
7.4.10.0000.00816.53
7.4.00.0030.00316.43

preferences:
37.47 ms | 403 KiB | 5 Q