<?php
class Product
{
	public function __construct($ean, $price, $count){
		$this->ean = $ean;
		$this->productPrice = $price;
		$this->productCount = $count;
	}
	
    public function __get($property) {
            if (property_exists($this, $property)) {
                return $this->$property;
            }
    }

}


function removeduplicateKeys($data){
    $tmp = [];
    for($i=0; $i < count($data); $i++){
    	if(!array_key_exists($data[$i]["ean"], $tmp)) {
    		$tmp[$data[$i]["ean"]] = $data[$i];
    	} else if ($data[$i]["productCount"] < $tmp[$data[$i]["ean"]]["productCount"]){
    		$tmp[$data[$i]["ean"]]["productCount"] = $data[$i]["productCount"];
    	}
  
	
    }
    
    $products = [];
     foreach($tmp as $p){
         array_push($products, new Product($p["ean"],
                                    $p["productPrice"],
                                    $p["productCount"]));
     }
    
      
   return $products;
}


// $arr =array( 
// "0" => Array
// (
//     "ean" => 6900532615069,
//     "productPrice" => 1140,
//     "productCount" => 5
// ),
// "1" => Array
// (
//     "ean" => 6900532615069,
//     "productPrice" => 1140,
//     "productCount" => 50
// ),
// "2" => Array
// (
//     "ean" => 6900535364122,
//     "productPrice" => 1140,
//     "productCount" => 50
// ),

// "3" => Array
// (
//     "ean" => 6900532615069,
//     "productPrice" => 1140,
//     "productCount" => 10,
// ));
$arr =array( 
"0" => Array
(
    "ean" => 6900532615069,
    "productPrice" => 1140,
    "productCount" => 10,
),	
"1" => Array
(
    "ean" => 6900532615069,
    "productPrice" => 1140,
    "productCount" => 50
),
"2" => Array
(
    "ean" => 6900535364122,
    "productPrice" => 1140,
    "productCount" => 50
),
"3" => Array
(
    "ean" => 6900535364122,
    "productPrice" => 1140,
    "productCount" => 500
),
"4" => Array
(
    "ean" => 6900535364122,
    "productPrice" => 1140,
    "productCount" => 0
),
"5" => Array
(
    "ean" => 6900532615069,
    "productPrice" => 1140,
    "productCount" => 10,
));

print_r(removeduplicateKeys($arr));