Skip to content

Instantly share code, notes, and snippets.

@thisislawatts
Created August 21, 2015 10:16
Show Gist options
  • Save thisislawatts/3f8f00446e7308e7e4d6 to your computer and use it in GitHub Desktop.
Save thisislawatts/3f8f00446e7308e7e4d6 to your computer and use it in GitHub Desktop.
array_unique_deep
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