What's the fastest (best performing) way in PHP to transform a (My)SQL result like:
array(
array('user_name' => 'john', 'tag_id' => 1, 'tag_name' => 'foo'),
array('user_name' => 'john', 'tag_id' => 2, 'tag_name' => 'bar'),
array('user_name' => 'rick', 'tag_id' => 3, 'tag_name' => 'foobar'),
array('user_name' => 'rick', 'tag_id' => 2, 'tag_name' => 'bar')
);
Into the easier to use:
array(
array('name' => 'john', 'tags' => array(
array('id' => 1, 'name' => 'foo'),
array('id' => 2, 'name' => 'bar')
),
array('name' => 'rick', 'tags' => array(
array('id' => 3, 'name' => 'foobar'),
array('id' => 2, 'name' => 'bar')
)
);
Or is there a library that does this already, without the added inflexibility and performance hit of full ORM?
Thanks