3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr1 = [ ['customer_id' => 1, 'Expire' => '2019-05-14', 'paid' => 1], ['customer_id' => 2, 'Expire' => '2019-06-20', 'paid' => 0], ['customer_id' => 2, 'Expire' => '2019-06-21', 'paid' => 1], ]; $arr2 = [ ['id' => 3943, 'customer_id' => 1, 'Expire' => '2019-05-14'], ['id' => 3944, 'customer_id' => 1, 'Expire' => '2019-05-14'], ['id' => 4713, 'customer_id' => 2, 'Expire' => '2019-06-20'], ['id' => 4714, 'customer_id' => 2, 'Expire' => '2019-06-21'] ]; foreach ($arr2 as &$a) { // Find the sub-array of $arr1 that matches this array's date and ID $arr1_match = array_filter($arr1, function($v) use ($a) { return $v['customer_id'] == $a['customer_id'] && $v['Expire'] == $a['Expire']; }); // Get the first element from the result $paid = reset($arr1_match)['paid']; // Append the paid-value to this array (done by reference) $a['paid'] = $paid; } print_r($arr2);

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.3.70.0100.00716.75
8.3.60.0120.00318.31
8.3.50.0100.00718.36
8.3.40.0040.01118.84
8.3.30.0090.00618.80
8.3.20.0040.00421.03
8.3.10.0000.00823.61
8.3.00.0080.00420.83
8.2.190.0040.01118.54
8.2.180.0090.00925.92
8.2.170.0140.00418.91
8.2.160.0030.01020.49
8.2.150.0040.00424.18
8.2.140.0050.00324.66
8.2.130.0040.00426.16
8.2.120.0030.00717.75
8.2.110.0050.00519.32
8.2.100.0090.00319.51
8.2.90.0050.00317.75
8.2.80.0030.00518.71
8.2.70.0040.00417.63
8.2.60.0100.00017.93
8.2.50.0070.00418.07
8.2.40.0080.00020.03
8.2.30.0040.00418.07
8.2.20.0000.00718.11
8.2.10.0040.00419.30
8.2.00.0000.00718.04
8.1.280.0030.01425.92
8.1.270.0000.00820.43
8.1.260.0000.00826.35
8.1.250.0070.00028.09
8.1.240.0060.00319.13
8.1.230.0070.00417.89
8.1.220.0000.00817.79
8.1.210.0060.00318.77
8.1.200.0080.00017.48
8.1.190.0000.00817.36
8.1.180.0030.00519.31
8.1.170.0030.00518.69
8.1.160.0050.00218.91
8.1.150.0040.00418.81
8.1.140.0030.00518.93
8.1.130.0070.00017.46
8.1.120.0000.00717.46
8.1.110.0050.00317.49
8.1.100.0040.00417.47
8.1.90.0030.00717.36
8.1.80.0070.00017.51
8.1.70.0030.00317.43
8.1.60.0030.00717.56
8.1.50.0050.00317.54
8.1.40.0050.00317.59
8.1.30.0030.00517.66
8.1.20.0040.00417.71
8.1.10.0070.00017.58
8.1.00.0040.00417.53
8.0.300.0030.00518.77
8.0.290.0030.00616.75
8.0.280.0080.00018.32
8.0.270.0000.00716.82
8.0.260.0000.00616.75
8.0.250.0030.00716.84
8.0.240.0050.00316.85
8.0.230.0000.00816.86
8.0.220.0000.00716.81
8.0.210.0030.00316.91
8.0.200.0000.00716.97
8.0.190.0040.00416.97
8.0.180.0050.00216.82
8.0.170.0030.00516.94
8.0.160.0000.00716.85
8.0.150.0040.00416.91
8.0.140.0040.00416.86
8.0.130.0050.00013.32
8.0.120.0000.00716.77
8.0.110.0060.00316.91
8.0.100.0030.00416.78
8.0.90.0040.00416.75
8.0.80.0080.00816.89
8.0.70.0000.00716.96
8.0.60.0000.00716.91
8.0.50.0000.00716.91
8.0.30.0100.01117.03
8.0.20.0120.00617.08
8.0.10.0080.00017.04
8.0.00.0090.00816.77
7.4.330.0050.00016.76
7.4.320.0060.00016.57
7.4.300.0000.00616.65
7.4.290.0000.00716.64
7.4.280.0000.00716.49
7.4.270.0030.00616.58
7.4.260.0050.00216.56
7.4.250.0040.00416.58
7.4.240.0070.00016.49
7.4.230.0070.00016.50
7.4.220.0030.00516.54
7.4.210.0020.01216.62
7.4.200.0030.00316.57
7.4.160.0090.00916.45
7.4.140.0040.01317.86
7.4.130.0030.01316.55
7.4.120.0060.01216.57
7.4.110.0170.00016.64
7.4.100.0170.00016.48
7.4.90.0090.01316.50
7.4.80.0060.01019.39
7.4.70.0070.01016.32
7.4.60.0070.01316.55
7.4.50.0100.00316.39
7.4.40.0150.00616.51
7.4.00.0040.01114.73
7.3.330.0050.00013.37
7.3.320.0000.00513.23
7.3.310.0040.00416.36
7.3.300.0030.00316.20
7.3.290.0000.00716.42
7.3.280.0080.00916.38
7.3.260.0070.01116.48
7.3.240.0080.00916.44
7.3.230.0150.00316.50
7.3.210.0130.01016.38
7.3.200.0180.01316.60
7.3.190.0000.01716.33
7.3.180.0150.01016.44
7.3.170.0080.00816.43
7.3.160.0130.00316.29
7.3.40.0090.00314.82
7.3.30.0060.00614.83
7.3.20.0080.00316.52
7.3.10.0090.00616.66
7.3.00.0090.00616.73
7.2.330.0070.01616.73
7.2.320.0120.00816.70
7.2.310.0030.01416.64
7.2.300.0070.01116.46
7.2.290.0080.01116.84
7.2.170.0110.00015.16
7.2.160.0100.01015.10
7.2.150.0050.01517.13
7.2.140.0080.00417.05
7.2.130.0060.01516.88
7.2.120.0070.01116.90
7.2.110.0030.00916.79
7.2.100.0040.00716.85
7.2.90.0000.01016.72
7.2.80.0000.01517.03
7.2.70.0080.00316.87
7.2.60.0150.00617.02
7.2.50.0150.00017.02
7.2.40.0070.00717.11
7.2.30.0090.00317.01
7.2.20.0130.00817.00
7.2.10.0140.00016.91
7.2.00.0160.00616.91
7.1.280.0030.00915.77
7.1.270.0070.00515.77
7.1.260.0070.01315.75
7.1.250.0090.00315.89

preferences:
18.01 ms | 401 KiB | 5 Q