I just want to do one thing, I have an array with products, lets say like this (in simple way):
$products = array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k');
I am outputing that products in a slider (showing 3 products), and I have arrows (left and right).
Primary I am on page 1 ($page = 0;), and using array_slice($products, $page * 3, 3);, so it will return:
array('a', 'b', 'c');
When I click arrow right, it will show:
array('d', 'e', 'f');
Next:
array('g', 'h', 'i');
Next:
array('j', 'k');
And here is the point and my question. I want on this page to return array('j', 'k', 'a');
How can I do it in the simpliest way?
PS: array with products is generated dynamically.
PPS: I also want to do it in other direction, ie. when I click left arrow, and I am on the first page, I want to return array('i', 'j', 'k');
Any ideas are appreciated.
Thanks a lot.