3v4l.org

run code in 300+ PHP versions simultaneously
<?php function unique_multidim_array($array, $key) { $temp_array = array(); $i = 0; $key_array = array(); foreach($array as $val) { if (!in_array($val[$key], $key_array)) { $key_array[$i] = $val[$key]; $temp_array[$i] = $val; } $i++; } return $temp_array; } $content = [ [ "id" => 15710, "sale_id" => 6699, "item_id" => 300 ], [ "id" => 15711, "sale_id" => 6699, "item_id" => 300 ] ]; print_r(unique_multidim_array($content,'item_id')); ?>
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [0] => Array ( [id] => 15710 [sale_id] => 6699 [item_id] => 300 ) )

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:
165.68 ms | 405 KiB | 5 Q