Is there a better way in PHP to access this array in groups of three?
Let's say my array is a comma separated string like :
("Thora","Birch","Herself","Franklin Delano","Roosevelt","Himself (archive footage)","Martin Luther","King","Himself (archive footage) (uncredited)")
although the array can end up being much larger, each one will be different but still in logical groups of three (firstname, lastname, role).
What I'm trying to accomplish is looping through the array in groups of three, so that the first record would have firstname[0]=>"Thora", lastname[0]=>"Birch" and role[0]=>"Herself".
I'm only used to foreach
loops but don't see an extra parameter like "for each 3" so maybe someone can shed some light?
Thanks!