Remove “columns” from the subarrays of a two dimensional array

后端 未结 4 1780
盖世英雄少女心
盖世英雄少女心 2021-01-12 08:03

I have a simple, two dimensional array like this:

Array
    (
        [0] => Array
            (
                [0] => abc
                [1] => 1         


        
4条回答
  •  感动是毒
    2021-01-12 08:41

    Even with array_walk :

    array_walk(
        $aYourArray,
        function(&$aSubRow){
            $aSubRow = array_slice($aSubRow, 0, 2);
        }
    );
    

提交回复
热议问题