Convert multidimensional array into single array

后端 未结 20 1817
时光取名叫无心
时光取名叫无心 2020-11-22 10:39

I have an array which is multidimensional for no reason

/* This is how my array is currently */
Array
(
[0] => Array
    (
        [0] => Array
                


        
20条回答
  •  旧时难觅i
    2020-11-22 11:13

    This single line would do that:

    $array = array_column($array, 'plan');
    

    The first argument is an array | The second argument is an array key.

    For details, go to official documentation: https://www.php.net/manual/en/function.array-column.php.

提交回复
热议问题