Samuz Posted June 6, 2012 Share Posted June 6, 2012 How would I group a bunch of arrays into groups of 10 or so. Let's say I had 100 results all being returned in their own array. What would I do to get 10 groups of 10 (in the situation i'm grouping in groups of 10) or get 5 groups of 20 (in the situation i'm grouping in groups of 20) I'm mainly looking for a logical idea of how i'd go about this, help much appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/263784-grouping-sql-results/ Share on other sites More sharing options...
ejay Posted June 6, 2012 Share Posted June 6, 2012 //code to divide array into chunks of size 10 $group_size = 10; $input_array = array_chunk($input_array, $group_size, true) Quote Link to comment https://forums.phpfreaks.com/topic/263784-grouping-sql-results/#findComment-1351759 Share on other sites More sharing options...
Samuz Posted June 6, 2012 Author Share Posted June 6, 2012 //code to divide array into chunks of size 10 $group_size = 10; $input_array = array_chunk($input_array, $group_size, true) Yep that's perfect bro! Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/263784-grouping-sql-results/#findComment-1351760 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.