3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = array( '0' => Array ( '0' => Array ( 'name' => 'brand', 'value' => 54, 'id' => 5251, 'price' => 15000.0000 ), '1' => Array ( 'name' => 'model', 'value' => 1200, 'id' => 5251, 'price' => 15000.0000 ) ), '1' => Array ( '0' => Array ( 'name' => 'brand', 'value' => 54, 'id' => 5250, 'price' => 15000.0000 ), '1' => Array ( 'name' => 'brand', 'value' => 1200, 'id' => 5250, 'price' => 12000.0000 ) ), '2' => Array ( '0' => Array ( 'name' => 'brand', 'value' => 89, 'id' => 518, 'price' => 100.0000 ), '1' => Array ( 'name' => 'model', 'value' => 12, 'id' => 518, 'price' => 100 ) ) ); $res = []; foreach($arr as $k => $v){ if($v[0]['name'] == $v[1]['name']) $res[$v[0]['name']] = $v[0]['id']; } echo '<hr>'; print_r($res);
Output for git.master, git.master_jit, rfc.property-hooks
<hr>Array ( [brand] => 5250 )

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.48 ms | 405 KiB | 5 Q