Just for curiosity (I know it can be a single line foreach statement), is there some PHP array function (or a combination of many) that given an array like:
foreach
The easiest way is to use an array_column()
$result_arr = array_column($arr, 'name', 'id'); print_r($result_arr );