3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = array ( 'igive' => array ( 0 => array ( 'name' => 'Alex', 'shop_name' => 'Shop1', 'rights' => 'admin', 'who_use' => '', 'user_id' => '765754346', ), 1 => array ( 'name' => 'Dmitry', 'shop_name' => 'Shop2', 'rights' => 'manager', 'who_use' => '', 'user_id' => '123456789', ), ), 'giventome' => array ( ), ); /* how to get a value of 'shop_nam'e where 'user_id' = 123456789;*/ $user_id = '765754346'; $shop_name = ''; array_walk($arr['igive'], function($v, $k) use (&$shop_name, $user_id){ ($v['user_id'] == $user_id) ? ($shop_name = $v['shop_name']) : ''; }); echo $shop_name;
Output for git.master, git.master_jit, rfc.property-hooks
Shop1

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:
50.75 ms | 401 KiB | 8 Q