Array or !Array

I was struggling with a loop check I needed to do.

I needed to find how many of occurrences there where based on some key info that had to be unique.

$eyeColors = [];

foreach ($list as $listItem) {
    $key = $listItem->eyeColor;
    if (!array_key_exists($key, $eyeColors)) {
        $eyeColors[$key] = array_push($eyeColors, $listItem)
  } 
}

Learned this from @mortenbergset