With the help of the Acme Corporation, I bring a PHP class to work with array collections: grouping, filtering, keys renaming and little more.
Group results by category name:
Array ( [php] => Array [0] => Array [id] => 1 ... [1] => Array [id] => 2 ... [2] => Array [id] => 5 ... [3] => Array [id] => 9 ... [css] => Array [0] => Array [id] => 3 ... [1] => Array [id] => 7 ... [js] => Array [0] => Array [id] => 4 ... [1] => Array [id] => 6 ... [2] => Array [id] => 8 ... )
Group results by category name and filter columns:
Array ( [php] => Array [0] => Array [content] => php content 1 [1] => Array [content] => php content 2 [2] => Array [content] => php content 3 [3] => Array [content] => php content 4 [css] => Array [0] => Array [content] => css content 1 [1] => Array [content] => css content 2 [js] => Array [0] => Array [content] => js content 1 [1] => Array [content] => js content 2 [2] => Array [content] => js content 3 )
Group results by category name, filter columns and unwrap:
Array ( [php] => Array [0] => php content 1 [1] => php content 2 [2] => php content 3 [3] => php content 4 [css] => Array [0] => css content 1 [1] => css content 2 [js] => Array [0] => js content 1 [1] => js content 2 [2] => js content 3 )
Group results by category and author:
Array ( [php] => Array [Michael Campbell] => Array [0] => Array [id] => 1 ... [Stella Kelly] => Array [0] => Array [id] => 2 ... [Michael Hansen] => Array [0] => Array [id] => 5 ... [Lisa Campbell] => Array [0] => Array [id] => 9 ... [css] => Array [Lisa Campbell] => Array [0] => Array [id] => 3 ... [1] => Array [id] => 7 ... [js] => Array [Richard Hansen] => Array [0] => Array [id] => 4 ... [1] => Array [id] => 6 ... [Doris Christmas] => Array [0] => Array [id] => 8 ... )
Group by post:
Array ( [1] => Array [0] => Array [blogpost_id] => 1 [blogpost_date] => 1359987879 [blogposti18n_id] => 1 [blogposti18n_blogpost_id] => 1 [blogposti18n_lang_id] => 1 [blogposti18n_title] => Título para 1 [1] => Array [blogpost_id] => 1 [blogpost_date] => 1359987879 [blogposti18n_id] => 2 [blogposti18n_blogpost_id] => 1 [blogposti18n_lang_id] => 2 [blogposti18n_title] => Title for 1 [2] => Array [0] => Array [blogpost_id] => 2 [blogpost_date] => 1359988171 [blogposti18n_id] => 3 [blogposti18n_blogpost_id] => 2 [blogposti18n_lang_id] => 1 [blogposti18n_title] => Título para 2 [1] => Array [blogpost_id] => 2 [blogpost_date] => 1359988171 [blogposti18n_id] => 4 [blogposti18n_blogpost_id] => 2 [blogposti18n_lang_id] => 2 [blogposti18n_title] => Title for 2 )
Organize and makeup:
Array ( [0] => Array [base] => Array [id] => 1 [date] => 1359987879 [i18n] => Array [0] => Array [id] => 1 [blogpost_id] => 1 [lang_id] => 1 [title] => Título para 1 [1] => Array [id] => 2 [blogpost_id] => 1 [lang_id] => 2 [title] => Title for 1 [1] => Array [base] => Array [id] => 2 [date] => 1359988171 [i18n] => Array [0] => Array [id] => 3 [blogpost_id] => 2 [lang_id] => 1 [title] => Título para 2 [1] => Array [id] => 4 [blogpost_id] => 2 [lang_id] => 2 [title] => Title for 2 )comments powered by Disqus