In Laravel 11.x, you can use `Arr::flatten()` to convert a multi-dimensional array into a single-level array.
Usage of `Arr::flatten()` in Laravel 11
The `Arr::flatten()` method is part of Laravel’s `Illuminate\Support\Arr` helper class and is used to flatten a nested array into a one-dimensional array.
Example Usage
use Illuminate\Support\Arr; $array = [ 'name' => 'John', 'skills' => [ 'PHP', 'Laravel', ['JavaScript', 'Vue.js'] ], 'contact' => [ 'email' => 'john@example.com', 'phone' => '123-456-7890' ] ]; $flattened = Arr::flatten($array); print_r($flattened);
Output:-
Array ( [0] => John [1] => PHP [2] => Laravel [3] => JavaScript [4] => Vue.js [5] => john@example.com [6] => 123-456-7890 )