Is there a function to extract a 'column' from an array in PHP?

前端 未结 14 1375
鱼传尺愫
鱼传尺愫 2020-11-21 07:33

I have an array of arrays, with the following structure :

array(array(\'page\' => \'page1\', \'name\' => \'pagename1\')
      array(\'page\' => \'pa         


        
14条回答
  •  北海茫月
    2020-11-21 08:16

    Why does it have to be a built in function? No, there is none, write your own.

    Here is a nice and easy one, as opposed to others in this thread.

    $namearray = array();
    
    foreach ($array as $item) {
        $namearray[] = $item['name'];
    }
    

提交回复
热议问题