in reply to for only returning one result

Well yeah, that's exactly what your loop does!

I don't know what $a starts as, but I'm assuming 0. On the first hit, $i is 2. $a is less than seven. If $slog[2] is true, $a is set to 2 + 5, or 7. Then $slog[2] and $slog[7] are printed. At the end of the loop, $a is incremented to 8. On the next loop, $a is 8 and the condition is false, so the loop stops.