The problem of two-dimensional array comparison?

$data = [
    ["foo" => "bar", "x" => "foo"],
    ["foo" => "bar1", "x" => "foo1"],
    ["foo" => "bar", "x" => "foo2"]
];

I need to delete the duplicate array of foo in this array, leaving only one item. How do you do that?

$data = [
    ["foo" => "bar", "x" => "foo"],
    ["foo" => "bar1", "x" => "foo1"],
];
Php
Mar.09,2021

        $tmp  = [];
        foreach ($data as $key => $datum) {
            if (in_array($datum['foo'], $tmp)) {
                unset($data[$key]);
                continue;
            }
            $tmp[] = $datum['foo'];
        }

//$arr = array_merge($data1,$data2);
//
  $key = 'foo';//
  $tmp_arr = array();//
  //var_dump($data);
 foreach($data as $k => $v)
 {
  if(in_array($v[$key], $tmp_arr))
//$v[$key]$tmp_arrtrue
  {
   unset($data[$k]);
   //$arrID
  }
 else {
   $tmp_arr[] = $v[$key];
   //id
  }
 }
var_dump($data);
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3c3b0-2c2ec.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3c3b0-2c2ec.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?