The problem with your code is this:
if (($numbers[$i] == $numbers[$i+1]) ...
When you reach the last element in your list that will be false, because there is no next element. And since the previous element doesn't match, it fails.
Without solving it for you (since I'm guessing this is homework), one way to fix it would be to add another 'or' clause that checks to see if it is the last element in the array.
Brad
In reply to Re: array matching problems
by bgreenlee
in thread array matching problems
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |