取消设置不删除多维数组中的键

unset not deleting key in multidimensional array

我有多维数组,想删除它存在的交付位置

   Array
     (
     [0] => Array
      (
        [amountReceived] => 1
        [deliveryLocation] => germany
      )

      [1] => Array
       (
        [amountReceived] => 2
        [deliveryLocation] => bulgaria
       )
     )

PHP

     foreach ($arr as $val) 
      {
        foreach($val as $k => $v)
        {
            if($k == 'deliveryLocation')
            {
                unset($arr[$k]);
            }
        }
      }

      return $arr;

问题是它在没有从数组中删除任何键的情况下返回数组上方。

简单易懂的方式

$t=0;
foreach ($arr as $val)
{
      unset($arr[$temp]['deliveryLocation']);
      $t++;
}