3v4l.org

run code in 500+ PHP versions simultaneously
<?php $specialkeys = ['aa', 'bb', 'cc']; $myarray = [ ['aa' => 1234, 'bb' => 1000, 'cc' => 2345, 'xx' => 'wsad'], ['aa' => 1234, 'bb' => 2000, 'cc' => 2345, 'xx' => 'wsad'], ['aa' => 1234, 'bb' => 2000, 'cc' => 2345, 'xx' => 'wsad'] ]; $lookup = []; foreach ($myarray as $row) { foreach ($specialkeys as $col) { $lookup[$col][$row[$col]] ??= -1; ++$lookup[$col][$row[$col]]; } } //var_export($lookup); foreach ($myarray as &$row) { foreach ($specialkeys as $col) { if ($lookup[$col][$row[$col]]) { $row['yy'][$col] = $row[$col]; unset($row[$col]); } } } var_export($myarray);

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.60.0100.00618.67
8.5.50.0120.00516.76
8.5.30.0090.00820.66
8.5.20.0100.00721.24
8.5.10.0100.00920.13
8.5.00.0070.00522.93
8.4.210.0060.01221.13
8.4.180.0160.00719.64
8.4.170.0120.01023.82
8.4.160.0130.00922.36
8.4.150.0060.00616.86
8.4.140.0110.01017.69
8.4.130.0030.00617.78
8.4.120.0110.00924.05
8.4.110.0060.00423.21
8.4.100.0100.00918.95
8.4.90.0090.01118.96
8.4.80.0090.01018.89
8.4.70.0110.01017.93
8.4.60.0120.00818.53
8.4.50.0050.00618.66
8.4.40.0130.00619.65
8.4.30.0090.00620.44
8.4.20.0100.01017.88
8.4.10.0090.00022.07
8.3.300.0140.00819.31
8.3.290.0130.00820.81
8.3.280.0130.00818.42
8.3.270.0130.00716.49
8.3.260.0090.01017.26
8.3.250.0130.00619.06
8.3.240.0030.00517.32
8.3.230.0130.00516.80
8.3.220.0080.01018.97
8.3.210.0110.00816.51
8.3.200.0050.00316.59
8.3.190.0110.01017.08
8.3.180.0080.00917.48
8.3.170.0040.00422.61
8.3.160.0030.01617.39
8.3.150.0110.01116.61
8.3.140.0100.00716.72
8.3.130.0040.00418.42
8.3.120.0050.00520.84
8.3.110.0030.00518.53
8.3.100.0030.00616.59
8.3.90.0120.00326.77
8.3.80.0060.00316.63
8.3.70.0120.00616.63
8.3.60.0130.00616.50
8.3.50.0040.01220.33
8.3.40.0070.00721.95
8.3.30.0140.00018.89
8.3.20.0040.00424.18
8.3.10.0000.00824.66
8.3.00.0030.00526.16
8.2.300.0090.01120.41
8.2.290.0110.00720.41
8.2.280.0090.01018.45
8.2.270.0090.00917.45
8.2.260.0140.00417.34
8.2.250.0060.00316.96
8.2.240.0130.00717.25
8.2.230.0080.00320.94
8.2.220.0040.01124.06
8.2.210.0080.00026.77
8.2.200.0090.00018.41
8.2.190.0140.00716.75
8.2.180.0070.01125.92
8.2.170.0130.00618.96
8.2.160.0110.00422.96
8.2.150.0000.00725.66
8.2.140.0070.00024.66
8.2.130.0080.00026.16
8.2.120.0080.00020.07
8.2.110.0030.00622.31
8.2.100.0120.00018.03
8.2.90.0040.00418.03
8.2.80.0050.00319.29
8.2.70.0030.00617.75
8.2.60.0000.00917.63
8.2.50.0030.00617.63
8.2.40.0060.00320.07
8.2.30.0000.00818.08
8.2.20.0000.00720.51
8.2.10.0030.00518.16
8.2.00.0040.00419.41
8.1.340.0140.00617.74
8.1.330.0120.00622.04
8.1.320.0100.01016.13
8.1.310.0000.00816.85
8.1.300.0110.00717.86
8.1.290.0030.00630.84
8.1.280.0140.00025.92
8.1.270.0040.00422.07
8.1.260.0090.00026.35
8.1.250.0050.00228.09
8.1.240.0080.00022.20
8.1.230.0040.00820.95
8.1.220.0060.00317.74
8.1.210.0030.00618.77
8.1.200.0030.00617.35
8.1.190.0040.00417.25
8.1.180.0040.00418.10
8.1.170.0040.00418.50
8.1.160.0000.00818.93
8.1.150.0080.00018.67
8.1.140.0000.00817.42
8.1.130.0080.00018.93
8.1.120.0040.00417.46
8.1.110.0020.00517.39
8.1.100.0040.00417.50
8.1.90.0040.00417.43
8.1.80.0100.00517.33
8.1.70.0130.00417.38
8.1.60.0110.00817.54
8.1.50.0150.00317.57
8.1.40.0120.00517.52
8.1.30.0090.00717.69
8.1.20.0160.00017.57
8.1.10.0150.00217.49
8.1.00.0170.00017.40
8.0.300.0070.00020.29
8.0.290.0040.00416.88
8.0.280.0060.00320.14
8.0.270.0000.00718.05
8.0.260.0080.00018.40
8.0.250.0070.00016.88
8.0.240.0050.00216.91
8.0.230.0070.00016.98
8.0.220.0030.00316.95
8.0.210.0040.00916.79
8.0.200.0130.00316.84
8.0.190.0100.00616.91
8.0.180.0100.00616.82
8.0.170.0120.00316.70
8.0.160.0100.00516.81
8.0.150.0100.00616.86
8.0.140.0100.00516.84
8.0.130.0060.01016.78
8.0.120.0120.00316.90
8.0.110.0070.00816.85
8.0.100.0090.00416.79
8.0.90.0080.00816.71
8.0.80.0120.00116.83
8.0.70.0060.00416.75
8.0.60.0090.00016.71
8.0.50.0070.00516.84
8.0.30.0100.00416.78
8.0.20.0040.00716.95
8.0.10.0130.00116.89
7.4.330.0020.00215.55
7.4.320.0030.00316.62
7.4.300.0120.00016.58
7.4.290.0120.00116.46
7.4.280.0110.00116.45
7.4.270.0090.00316.54
7.4.260.0100.00516.44
7.4.250.0150.00016.49
7.4.240.0130.00316.54
7.4.230.0130.00416.55
7.4.220.0040.01216.47
7.4.210.0090.00316.32
7.4.200.0110.00216.56
7.4.190.0120.00116.56
7.4.180.0080.00616.62
7.4.160.0120.00416.53
7.4.150.0100.00516.40
7.4.140.0110.00316.34
7.4.130.0070.00516.40
7.4.120.0110.00416.46
7.4.110.0110.00316.37
7.4.100.0070.00516.49
7.4.90.0090.00316.25
7.4.80.0080.00516.30
7.4.70.0070.00616.22
7.4.60.0100.00216.42
7.4.50.0090.00316.40
7.4.40.0070.00616.28
7.4.30.0090.00416.24
7.4.20.0100.00616.40
7.4.10.0070.00916.49
7.4.00.0120.00416.44

preferences:
97.79 ms | 1319 KiB | 5 Q