I have an array. after print_r($arr) as below:
Array (
[0] => Array (
[groupid] => 5
[radminid] => 1
[type] => system
[system] => private
)
[1] => Array (
[groupid] => 10
[radminid] => 2
[type] => system
[system] => private
)
)
I would like to change the array key to groupid, something like $arr[$arr[groupid]] and I tried
foreach($array as $key => $value){
$arr[$value] = $arr[$arr['groupid']];
}
How to use the $arr[groupid] as $arr key? below is what I need.
Array (
[5] => Array (
[groupid] => 5
[radminid] => 1
[type] => system
[system] => private
)
[10] => Array (
[groupid] => 10
[radminid] => 2
[type] => system
[system] => private
)
)
Thank you.