I'm looking for a more professional method to solve a very simple problem.
I have an array like :
$originalArray = [
0 => [
'id' => 22,
],
1 => [
'id' => 9,
],
2 => [
'id' => 15,
],
]
Knowing all those ids are unique, I want to simplify the array to something like:
$peeledResult = [
0 => 22,
1=> 9,
2 => 15,
]
The following is my basic solution for it but I was wondering if there is a more elegant method to achieve the same.
$peeledResult = [];
foreach ($originalArray as $item) {
$peeledResult[] = $role['id'];
}
Thanks for any advice in advance :)