I have a collection that has 2 arrays like on this picture:
So there are:
array 63 has two keys 70 and 72
array 64 has key 71
What i want to do is to get the keys 70, 72, 71.
How to get those keys??
I have a collection that has 2 arrays like on this picture:
So there are:
array 63 has two keys 70 and 72
array 64 has key 71
What i want to do is to get the keys 70, 72, 71.
How to get those keys??
$keys = $collection->flatMap(function ($item) {
return array_keys($item);
});
If you think there may be duplicates, tack on a call to unique at the end:
$keys = $collection->flatMap(function ($item) {
return array_keys($item);
})->unique();