3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ ['user_id' => 82, 'ac_type' => 1, 'irrelevant' => 'a'], ['user_id' => 80, 'ac_type' => 5, 'irrelevant' => 'b'], ['user_id' => 76, 'ac_type' => 1, 'irrelevant' => 'c'], ['user_id' => 82, 'ac_type' => 1, 'irrelevant' => 'd'], ['user_id' => 80, 'ac_type' => 5, 'irrelevant' => 'e'] ]; foreach ($array as $row) { $compositeKey = $row['user_id'] . '_' . $row['ac_type']; $result[$compositeKey] ??= $row; // only store if first occurrence of compositeKey } var_export(array_values($result)); // re-index and print
Output for git.master, git.master_jit, rfc.property-hooks
array ( 0 => array ( 'user_id' => 82, 'ac_type' => 1, 'irrelevant' => 'a', ), 1 => array ( 'user_id' => 80, 'ac_type' => 5, 'irrelevant' => 'b', ), 2 => array ( 'user_id' => 76, 'ac_type' => 1, 'irrelevant' => 'c', ), )

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