3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = [ ['id' => 1, 'text' => 'text1', 'type' => 'A'], ['id' => 1, 'text' => 'text2', 'type' => 'B'], ['id' => 1, 'text' => 'text3', 'type' => 'C'], ['id' => 2, 'text' => 'text4', 'type' => 'A'], ['id' => 2, 'text' => 'text5', 'type' => 'B'], ['id' => 2, 'text' => 'text6', 'type' => 'C'], ['id' => 3, 'text' => 'text7', 'type' => 'A'], ['id' => 3, 'text' => 'text8', 'type' => 'B'], ['id' => 3, 'text' => 'text9', 'type' => 'C'], ]; $newArr = []; $ids = array_values(array_unique(array_column($arr, 'id'))); foreach ($ids as $key => $id) { foreach ($arr as $value) { if ($value['id'] === $id) { $newArr[$key]['id'] = $id; $newArr[$key][$value['type']] = $value['text']; } } } echo '<pre>'; print_r($newArr); echo '</pre>';
Output for git.master, git.master_jit, rfc.property-hooks
<pre>Array ( [0] => Array ( [id] => 1 [A] => text1 [B] => text2 [C] => text3 ) [1] => Array ( [id] => 2 [A] => text4 [B] => text5 [C] => text6 ) [2] => Array ( [id] => 3 [A] => text7 [B] => text8 [C] => text9 ) ) </pre>

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:
62.74 ms | 1605 KiB | 4 Q