Skip to content

Instantly share code, notes, and snippets.

@twysto
Last active July 21, 2017 07:57
Show Gist options
  • Save twysto/f42b21cb18582f4a4368 to your computer and use it in GitHub Desktop.
Save twysto/f42b21cb18582f4a4368 to your computer and use it in GitHub Desktop.
[PHP] array_unique in a multi-dimensional array
<?php
function array_multi_unique($array) {
$tmp_ComparisonArray = $final_Array = Array();
foreach($array as $key => $value) {
if(!in_array($value[0], $tmp_ComparisonArray)) {
$tmp_ComparisonArray[] = $value[0];
$final_Array[] = $value;
}
}
return $final_Array;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment