To amplify the points made by ChOas and kschwab:
the loop test of --$i also means that the loop
won't execute if the array has a single element, since the
test is made before the first execution. It also means that
the loop will die with mysterious errors if the array is
empty, since -1 passes the test.