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) { $customerID = $a['customer_id']; $arr1_key = array_search($customerID, array_column($arr1, 'customer_id')); $paid = $arr1[$arr1_key]['paid']; $a['paid'] = $paid; } print_r($arr2);
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [0] => Array ( [id] => 3943 [customer_id] => 1 [Expire] => 2019-05-14 [paid] => 1 ) [1] => Array ( [id] => 3944 [customer_id] => 1 [Expire] => 2019-05-14 [paid] => 1 ) [2] => Array ( [id] => 4713 [customer_id] => 2 [Expire] => 2019-06-20 [paid] => 0 ) [3] => Array ( [id] => 4714 [customer_id] => 2 [Expire] => 2019-06-21 [paid] => 0 ) )

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
32.04 ms | 402 KiB | 8 Q