I have a loop (based on an array – which could grow but NOT too much – max 6 keys) e.g.: array('12','34','56',48'). What I would like to do is loop through the array and THEN loop again to find the “previous” array val.
For example, key[0] = 12, key[1] = 34 then key[0] = 12, key[2] = 56 then key[1] = 34 etc.
The values of the array are ID’s from a DB and I need (hopefully) to run a query based on the “current key” and the previous key.
Any ideas – can it be done?
I don’t think multiple loops are really needed here. I would use the internal pointer of the array with
next(),prev(), andcurrent()functions.