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
I found I can do:
array_combine(array_map(function($o) { return $o->id; }, $objs), array_map(function($o) { return $o->name; }, $objs));
But it's ugly and requires two whole cycles on the same array.