S
Steve Hémond
Hi people,
This is actually a basic question ...
For each element of an array, I need to print the previous element, the
actual element, and the next element on a line.
Example :
@test = "One","Two","Three","Four","Five";
The program need to read each array element, then print its previous, actual
and next value :
Output :
*nothing*,One,Two
One, Two, Three
Two, Three, Four
Three,Four,Five
I was thinking of using a simple FOR statement :
for ($i=$array[0]; $i==$array[LAST ELEMENT]; $i++)
I know this is completely wrong. I just want to show you the logic I am
thinking about.
Any ideas ?
Thanks in advance,
Steve
This is actually a basic question ...
For each element of an array, I need to print the previous element, the
actual element, and the next element on a line.
Example :
@test = "One","Two","Three","Four","Five";
The program need to read each array element, then print its previous, actual
and next value :
Output :
*nothing*,One,Two
One, Two, Three
Two, Three, Four
Three,Four,Five
I was thinking of using a simple FOR statement :
for ($i=$array[0]; $i==$array[LAST ELEMENT]; $i++)
I know this is completely wrong. I just want to show you the logic I am
thinking about.
Any ideas ?
Thanks in advance,
Steve