3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function get_unique_array($array) { $result = array_map("unserialize", array_unique(array_map("serialize", $array))); foreach ($result as $key => $value) { if ( is_array($value) ) { $result[$key] = get_unique_array($value); } } return $result; } $array = array( array('id' => '123', 'dddd' => 'dd'), array('id' => '123', 'dddd' => 'dd'), array('id' => '111', 'dddd' => 'dd') ); $rr = get_unique_array($array); echo '<pre>'; print_r($rr);
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
<pre>Array ( [0] => Array ( [id] => 123 [dddd] => dd ) [2] => Array ( [id] => 111 [dddd] => dd ) )