There are good answers to your general question above, but one line jumped out at me:
if (($i == 7) | ($i == 14) | ($i == 21) | ($i == 28) | ... ){
The first thing to jump out is the use of a bitwise or instead of a logical or. Correcting that leaves
if (($i == 7) || ($i == 14) || ($i == 21) || ($i == 28) || ... ) {
which still has a problem: unecessary parenthesis
creating single-elements lists, each containing a boolean. Correcting this leaves
if ( $i == 7 || $i == 14 || $i == 21 || $i == 28 || ... ) {
This is correct, but a cursory glance shows that the intent is determine whether $i is a multiple of 7 (or, said another way, that $i is divisible by 7 without remainder). There's an easy way to express that:
if ( $i % 7 == 0 ) {
Phrased this way, you can increase the upper bound on your loop safely without having to add another condition to if
if statement. Anytime you have to change code in more than one place to increase the range of a loop, a flag should go up.