3v4l.org

run code in 300+ PHP versions simultaneously
<?php function unique_multidim_array($array, $key) { $uniq = []; foreach($array as $val) { $curVal = $val[$key]; // shortcut of the value $uniq[$curVal] = $val; // override previous value if exists } return array_values($uniq); // array_values to re-index array } $exists = [ ['intervention_id' => 2, 'exists' => 'yes'], ['intervention_id' => 2, 'exists' => 'no'], ['intervention_id' => 2, 'exists' => 'yes'], ['intervention_id' => 5, 'exists' => 'yes'], ['intervention_id' => 6, 'exists' => 'no'], ['intervention_id' => 12, 'exists' => 'yes'], ]; $uniq = unique_multidim_array($exists, 'intervention_id'); print_r($uniq);
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [0] => Array ( [intervention_id] => 2 [exists] => yes ) [1] => Array ( [intervention_id] => 5 [exists] => yes ) [2] => Array ( [intervention_id] => 6 [exists] => no ) [3] => Array ( [intervention_id] => 12 [exists] => yes ) )

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:
50.77 ms | 402 KiB | 8 Q