3v4l.org

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

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:
169.01 ms | 406 KiB | 5 Q