Print only unique values from array

Is there away to filter duplicate entries from an array. Im an trying to echo only unique values from an array.


$sql = mysql("SELECT * from db");
while($row = mysql_fetch_array($sql)){
$value = $row['thisrow'];
echo unique values only;

or something like this…

$test = array('1' => 'One', '2' => 'Two', '3' => 'One');
foreach($test as $Key => $Value){
if(Does $value !== any other $value){
 echo $Value;

For any array:

$array = array_unique($array);



So if I were using an array I would pass it through the unique_array function:

$test = array('1' => 'One', 'Two', 'Three', 'One');
$test = array_unique($test);
 foreach($test as $k => $v){
  echo $v;

and if I were select from a database I would use DISTICNT(col) where column is where its looking for unique entries:

$sql = mysql_query("SELECT DISTINCT(unique_column) from table");
while($row = mysql_fetch_array($sql)) {
$uniquevalue = $row['unique value'];
echo $unique_value;

They both work! Thank you redprince!