3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr1 = [ [ 'id' => 1, 'name' => 'John', 'email' => 'j@mail.com' ], [ 'id' => 2, 'name' => 'Jane', 'email' => 'jane@mail.com' ] ]; $arr2 = [ [ 'id' => 1, 'email' => 'john@yahoo.com' ], [ 'id' => 2, 'email' => 'jane@yahoo.com' ], [ 'id' => 2, 'email' => 'jane.doe@hotmail.com' ], ]; foreach ($arr2 as ['id' => $id, 'email' => $lookup[$id][]]); foreach ($arr1 as ['id' => $id, 'email' => &$email]) { $email = array_merge((array) $email, $lookup[$id] ?? []); } var_export($arr1);

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.4.140.0120.01017.45
8.4.130.0150.00517.79
8.4.120.0120.00820.29
8.4.110.0110.00622.53
8.4.100.0090.01017.80
8.4.90.0110.01118.59
8.4.80.0050.00317.68
8.4.70.0030.00617.89
8.4.60.0040.00818.77
8.4.50.0120.00919.26
8.4.40.0030.01719.36
8.4.30.0070.01418.84
8.4.20.0130.01025.66
8.4.10.0060.00923.67
8.3.270.0110.00916.69
8.3.260.0120.00716.82
8.3.250.0100.00818.92
8.3.240.0100.00916.53
8.3.230.0120.00516.47
8.3.220.0050.00217.11
8.3.210.0030.00416.80
8.3.200.0050.00616.79
8.3.190.0100.00917.10
8.3.180.0040.00416.48
8.3.170.0120.00619.09
8.3.160.0150.00318.52
8.3.150.0040.00420.84
8.3.140.0080.00016.45
8.3.130.0030.00518.50
8.3.120.0170.00318.88
8.3.110.0160.00320.94
8.3.100.0090.00024.06
8.3.90.0050.00326.77
8.3.80.0060.00318.43
8.3.70.0120.00618.39
8.3.60.0100.00618.30
8.3.50.0150.00318.11
8.3.40.0070.00720.30
8.3.30.0030.01218.65
8.3.20.0050.00324.18
8.3.10.0000.00824.66
8.3.00.0040.00426.16
8.2.290.0120.00620.41
8.2.280.0110.00818.21
8.2.270.0120.00619.07
8.2.260.0080.00020.27
8.2.250.0000.00818.49
8.2.240.0060.00317.09
8.2.230.0100.00722.58
8.2.220.0080.00037.54
8.2.210.0100.01026.77
8.2.200.0050.00516.50
8.2.190.0090.00916.58
8.2.180.0110.01116.38
8.2.170.0120.00918.91
8.2.160.0040.01122.96
8.2.150.0050.00325.66
8.2.140.0000.00724.66
8.2.130.0040.00426.16
8.2.120.0040.00421.04
8.2.110.0030.00620.38
8.2.100.0110.00017.72
8.2.90.0040.00519.70
8.2.80.0000.00817.63
8.2.70.0080.00017.63
8.2.60.0000.00818.16
8.2.50.0080.00018.07
8.2.40.0050.00320.07
8.2.30.0040.00418.11
8.2.20.0000.00819.23
8.2.10.0070.01017.82
8.2.00.0140.00617.73
8.1.330.0040.00421.98
8.1.320.0090.01016.39
8.1.310.0110.00316.76
8.1.300.0060.01018.57
8.1.290.0030.00630.84
8.1.280.0150.00625.92
8.1.270.0000.00824.66
8.1.260.0080.00026.35
8.1.250.0050.00228.09
8.1.240.0030.00622.60
8.1.230.0030.00922.75
8.1.220.0000.00817.77
8.1.210.0060.00318.92
8.1.200.0030.00617.35
8.1.190.0080.00017.10
8.1.180.0040.00418.10
8.1.170.0000.00819.00
8.1.160.0040.00418.93
8.1.150.0050.00518.55
8.1.140.0110.00717.35
8.1.130.0180.00017.39
8.1.120.0110.00917.57
8.1.110.0190.00017.54
8.1.100.0080.00817.52
8.1.90.0180.00017.53
8.1.80.0170.00017.46
8.1.70.0090.00917.45
8.1.60.0180.00017.68
8.1.50.0090.00917.47
8.1.40.0140.00617.61
8.1.30.0130.00817.55
8.1.20.0180.00017.67
8.1.10.0140.00417.64
8.1.00.0130.00317.52
8.0.300.0070.00019.95
8.0.290.0040.00416.75
8.0.280.0030.00318.52
8.0.270.0150.00016.83
8.0.260.0160.00316.84
8.0.250.0080.00417.01
8.0.240.0090.00416.87
8.0.230.0160.00016.92
8.0.220.0170.00016.72
8.0.210.0090.00316.79
8.0.200.0180.00016.81
8.0.190.0050.01216.89
8.0.180.0070.01016.88
8.0.170.0040.01316.89
8.0.160.0150.00016.80
8.0.150.0140.00316.73
8.0.140.0110.00416.73
8.0.130.0060.01116.71
8.0.120.0090.00916.83
8.0.110.0060.00916.84
8.0.100.0150.00016.71
8.0.90.0100.00516.82
8.0.80.0140.00016.73
8.0.70.0130.00416.82
8.0.60.0120.00316.75
8.0.50.0060.00916.82
8.0.30.0080.00816.74
8.0.20.0100.00716.80
8.0.10.0040.01216.95
7.4.330.0040.00414.78

preferences:
32.49 ms | 403 KiB | 5 Q