Oh yeah, you've got it. And it's clear that you understand it, which is great.
Everything you said is right so now that you've got the foundation, we can point out a few nitpicks.
First, this is unnecessary:
if ($wspmay[$i] <7) { $wspmay[$i] = 0; }
if ($wspmay[$i] >8) { $wspmay[$i] = 0; }
Instead, you can say:
if ($wspmay[$i] <7 or $wspmay[$i] >8) { $wspmay[$i] = 0; }
When you wrote this:
$i++; increases the $i variable by 1 and the the loop repeats until $i=$c
You were almost exactly right but technically, an array $x with 5 items goes from $x[0] to $x[4]
That is: $x[0], $x[1], $x[2], $x[3], and $x[4] is 5 elements in the array.
So your sentence isn't exactly right. $i++ keeps increasing the variable by one and the loop repeats until $i is one less than $c. But you were getting the right idea.
I use while loops out of habit. A better programmer might use a different loop for that.
And lastly, my instruction assumes that every element is sequentially numbered. That is, 1,2,3,4,5,6,7,8 all the way up to 19,20,21. And that's not a good assumption. I mean, it happens to be true in this case but it won't always be true. So it's better to learn a technique that works whether the elements are sequentially numbered or not.
And a good technique for that is:
foreach ($wspgo as $k=>$v) { }
This way, if the array looks like this:
$wspgo[1] = 17
$wspgo[4] = 7
$wspgo[10] = 1
You can see that there are three elements. And remember that $c=count($wspgo) so $c will be three. And when I start $i at zero and go up to 2, I will be checking the variables $wspgo[0], $wspgo[1], and $wspgo[2] which of course don't exist.
But if you use the foreach technique, then you end up with variables $k and $v (which is short for Key and Value). So the first time the foreach loop happens, $k is 1 and $v is 17. And you can do your if statements on $v. And then you finish the loop. The next time through, $k will be 4 and $v will be 7.
So barand was about three steps ahead of us - and he was doing it the right way - I just wanted you to be able to see the long hand version so that you could learn to write your own code.