Convert multidimensional array into single array

后端 未结 20 1944
时光取名叫无心
时光取名叫无心 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:10

    For this particular case, this'll do:

    $array = array_map('current', $array[0]);
    

    It's basically the exact same question is this one, look at some answers there: PHP array merge from unknown number of parameters.

提交回复
热议问题