I\'m embarrassed to ask this and it\'s most likely a duplicate, but my google results are coming up short (im searching incorrectly I guess) and such a basic question is infuria
If you want to access the nth element without knowing the index, you can use next() n times to reach the nth element.
for($i = 0; $i<$n; $i++){ $myVal = next(); } echo $myVal;
There are other ways to access a specific element, already mentioned by @deceze.