So I am working on a JQuery Step Form. It is being populated with dynamic information from the database. I have a particular list of items that is 21 items in the array. I would like to break these down into groups of 5 or 6 per step, so the form isn't so long.
I know I could use array_slice for example, but since this list is dynamic, I don't know how many there will always be. It will kind of be paginated in a sense but I don't need pagination links and such. Just a way to return 5 items, then 5 items and if the last iteration only has 2 items then that is it.
So for example:
$array = (
array(
"name" => "Peter Parker",
"alterego" => "Spiderman",
),
array(
"name" => "Clark Kent",
"alterego" => "Superman",
),
array(
"name" => "Bruce Wayne",
"alterego" => "Batman",
),
);
And then I want to break this down to only list 2 items per group.