Greetings.
I have minimal (but growing) skills in programming in any language, and apologize in advance if this has been answered recently (several pages of "array" searches on Google and this forum haven't answered the question).
As an applied test, I decided to populate an HTML table with data from a PHP associative array, and have successfully done so using the FOREACH structures.
The data are a customer name, an ID number, and a ranking number. The array is sorted on any of the three fields, and fed to an HTML table, with the appropriate variables in each location.
While this seems to work fine for a table consisting of single instances of the record (with the three data elements per record) per loop, I decided I wanted to populate the table with side-by-side instances of the array records.
As an example:
Current Table:
Record 1: (1) (2) (3)
Record 2: (1) (2) (3)
Record 3: (1) (2) (3)
Proposed Table:
Record 1: (1) (2) (3) Record 2: (1) (2) (3)
Record 3: (1) (2) (3) Record 4: (1) (2) (3)
My difficulties are in seeing how I would manage to increment the pointer to allow two records to be accessed per cycle of FOREACH.
I've attempted to use NEXT, which does what I desire, until the next loop where I get a doubled record. (Record 1, Next to 2, Record 2, Next to 3...) I am assuming that NEXT does not actually move the array pointer.
I've looked at ARRAY_POP, which doesn't seem to provide the function I require, and reacts differently than I expected in practice.
At present, I'm studying the IMPLODE function, but that seems to be a rather cumbersome solution.
If one of you kind folk would care to point me to an example, or the proper PHP commands, I would be much obliged.