in reply to looping in 2d array

The one thing which looks a little odd is that the only references to $i3 are in the for statement itself. You have set up this variable to loop from 1 to 9 but then you never use the variable inside the loop. Is this intentional?