Created
August 21, 2015 10:16
-
-
Save thisislawatts/3f8f00446e7308e7e4d6 to your computer and use it in GitHub Desktop.
array_unique_deep
This file contains hidden or 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
function array_unique_deep( $array ) { | |
$uniq = array(); | |
foreach ($array as $key => $value) { | |
$str = json_encode( $value ); | |
if ( in_array( $str, $uniq ) ){ | |
unset( $array[$key] ); | |
} else { | |
$uniq[] = $str; | |
} | |
} | |
return $array; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment