Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require __DIR__.'/vendor/autoload.php';
- $a = [
- [
- "id" => 24, "child" => [
- "id" => 29, "child" => [
- "id" => 50, "child" => [
- "id" => 82, "child" => []
- ]
- ]
- ]
- ],
- [ "id" => 30, "child" => [], ],
- [ "id" => 31, "child" => [], ],
- [ "id" => 32, "child" => [], ],
- ];
- $childIds = collect($a)->map(function ($item) {
- return collect($item)->flatten();
- });
- dd($childIds->all());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement