in reply to is $i=+3 valid?

I think you are trying to increment the value of $i here. For that you should use: $i+=3 This will add 3 to your current $i value. $i=+3 is just like assigning "+3" i.e. positive 3 value to $i.