3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = array( array( 'id' => 1, 'user_name'=>'test1' ), array( 'id' => 2, 'user_name'=>'test2' ), array( 'id' => 3, 'user_name'=>'test3' ) ); $arr2 = array( array( 'id' => 1, 'shop_name'=>'shop1' ), array( 'id' => 5, 'shop_name'=>'shop2' ), array( 'id' => 3, 'shop_name'=>'shop3' ) ); $user_name = array_column($arr, 'user_name', 'id'); $shop_name = array_column($arr, 'shop_name', 'id'); $arr = []; foreach($user_name as $id => $user) { $temp = ['id'=>$id, 'user_name'=>$user, 'shop_name'=>'']; if(array_key_exists($id, $shop_name)) $temp['shop_name'] = $shop_name[$id]; $arr[] = $temp; } print_r($arr);
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [0] => Array ( [id] => 1 [user_name] => test1 [shop_name] => ) [1] => Array ( [id] => 2 [user_name] => test2 [shop_name] => ) [2] => Array ( [id] => 3 [user_name] => test3 [shop_name] => ) )

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:
44.64 ms | 402 KiB | 8 Q