3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = [ [ 'id' => 10, 'name' => 'John', 'occupation' => 'engineer', 'points' => 10 ], [ 'id' => 10, 'name' => 'John', 'occupation' => 'librarian', 'points' => 14 ], [ 'id' => 7, 'name' => 'Sarah', 'occupation' => 'artist', 'points' => 21 ], [ 'id' => 7, 'name' => 'Sarah', 'occupation' => 'teacher', 'points' => 17 ], [ 'id' => 10, 'name' => 'John', 'occupation' => 'butcher', 'points' => 7 ], [ 'id' => 7, 'name' => 'Sarah', 'occupation' => 'engineer', 'points' => 9 ], [ 'id' => 25, 'name' => 'Andreea', 'occupation' => 'judge', 'points' => 11 ] ]; $result = []; foreach($arr as $v){ $result[$v["id"]][] = $v; } print_r($result);
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [10] => Array ( [0] => Array ( [id] => 10 [name] => John [occupation] => engineer [points] => 10 ) [1] => Array ( [id] => 10 [name] => John [occupation] => librarian [points] => 14 ) [2] => Array ( [id] => 10 [name] => John [occupation] => butcher [points] => 7 ) ) [7] => Array ( [0] => Array ( [id] => 7 [name] => Sarah [occupation] => artist [points] => 21 ) [1] => Array ( [id] => 7 [name] => Sarah [occupation] => teacher [points] => 17 ) [2] => Array ( [id] => 7 [name] => Sarah [occupation] => engineer [points] => 9 ) ) [25] => Array ( [0] => Array ( [id] => 25 [name] => Andreea [occupation] => judge [points] => 11 ) ) )

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:
30.19 ms | 411 KiB | 5 Q