[Solved] Remove From multidimensional array if a value is duplicate [duplicate]


Something like this shall do the trick:

$knownIds = array();
foreach( $myArray AS $key=>$item ) {
  if( array_key_exists($item['event_id'], $knownIds) === true ) {
    unset( $myArray[$key] );
  } else {
    $knownIds[$item['event_id']] = $key;  // value does not matter really here
  }
}
$myArray = array_values($myArray);

where $myArray is your source array.

3

solved Remove From multidimensional array if a value is duplicate [duplicate]