That would have been one of my hints about shaders on mobile devices, if you hadn't it found out already...
It's actually fine to use that for-loop and it does work on some chips/drivers but not on others. On Adreno chips, it can crash the phone badly when using this. That's why jPCT-AE's default shaders look that ugly with all these ifs in them.
Other hints:
Do as much as possible in the vertex shader. If you are doing calculations in the fragment shader that are not per fragment, move them into the vertex shader and use a varying to access the result.
Move complex uniforms into the vertex shader even if you need them in the fragment shader only if you update them every frame. For example: It's faster to put a vec4 uniform into the vertex shader and copy it into a varying to use it in the fragment shader than to put it directly into the fragment shader.
Be prepared for bugs in the shader compiler. PowerVR, nVidia and Mali are pretty much ok, but Adreno really sucks. But even on PowerVR, i had strange results with some shaders. For example, i had to introduce pointless variables with no need into the vertex shader to prevent the compiler from compiling a shader that paints everything in black (again, you can find this gem somewhere in the default shaders).
Don't rely on high precision in the fragment shader. The implementation is free to use medium precision instead and Mali chipset do so.
...