PHP多维数组提取


PHP Multi Dimensional Array Extract

im试图从foreach循环创建简单数组

function ptd_get_taxanomies(){
            foreach ($ptd_taxs as $ptd_tax) {
                $taxon_arg[] = array(
                    'taxonomy' =>$ptd_tax->taxonomy,
                    'field' => 'id',
                    'terms' => $values
                );
            }
    return $taxon_arg;
}

,但它会返回多维数组

    Array
(
    [0] => Array
        (
            [taxonomy] => application
            [field] => id
            [terms] => 8
        )
    [1] => Array
    (
        [taxonomy] => dimension
        [field] => id
        [terms] => 4
    )
);

但这不是我想要的,我需要这样的输出>

   array(
    'taxonomy' => 'application',
    'field' => 'id',
    'terms' => '8',
   ),
   array(
    'taxonomy' => 'dimension',
    'field' => 'id',
    'terms' => '4',
  )

如何删除第一级数组并获得上面的输出

function ptd_get_taxanomies(){
    foreach ($ptd_taxs as $ptd_tax) {
        $taxon_arg = $ptd_tax;            
    }
    return $taxon_arg;
}

只循环遍历结果?

$taxon_arg =ptd_get_taxanomies();
foreach($taxon_arg as $arg){
    var_dump($arg);
}