阅读(3777) (10)

Laravel 8 Arr::flatten() {#collection-method}

2021-07-02 16:49:00 更新

Arr::flatten 函数将多维数组中数组的值取出平铺为一维数组:

use IlluminateSupportArr;

$array = ['name' => 'Joe', 'languages' => ['PHP', 'Ruby']];

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

// ['Joe', 'PHP', 'Ruby']