Last active
July 21, 2017 07:57
-
-
Save twysto/f42b21cb18582f4a4368 to your computer and use it in GitHub Desktop.
[PHP] array_unique in a multi-dimensional array
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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