Convert multidimensional array into single array

后端 未结 20 1596
时光取名叫无心
时光取名叫无心 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条回答
  •  囚心锁ツ
    2020-11-22 11:04

    Despite that array_column will work nice here, in case you need to flatten any array no matter of it's internal structure you can use this array library to achieve it without ease:

    $flattened = Arr::flatten($array);
    

    which will produce exactly the array you want.

提交回复
热议问题