I know this doesn't work. I said above, that it doesn't work and I was wondering why.
The actual code I had in my site was the second example you showed.
But with PHP 5.x, this is not possible, and since they made it more 'explicit', you have to set the variable i before you ask about it. Which makes sense.