避免foreach中的重复元素

I would like the code below to display only one time each $row[2] element (no duplicates) :

foreach($rows as $row){
    echo " {$row[2]} ";
}

How can I achieve this ? Thanks.

My array is very big but here is a sample from var_dump

  [0]=>
  array(10) {
    [0]=> string(2) "39"
    ["id"]=> string(2) "39"
    [1]=> string(3) "abc"
    ["A"]=> string(3) "abc"
    [2]=> string(2) "123"
    ["B"]=> string(2) "123"
    [3]=> string(1) "0"
    ["C"]=> string(1) "0"
    [4]=> string(1) "1"
    ["D"]=> string(1) "1"
  }

I'm only interested about [2]=> string(2) "123".

Here is the code you can use:

$uniqueArr = array();
foreach ($rows as $row) { 
        if(!(in_array($row[2], $uniqueArr))) {
                echo $row[2];
                $uniqueArr[] = $row[2];
        }
}