There are several ways you could approach this :
1. Separate them
Since clearly, you're doing different code to the ranges 1-10, 11-20, a,d 21-30, then it would do you good to separate them into several for loops.
for ($i=1; $i <= 10; $i++) {
//code for $i 1-10
}
for ($i=11; $i <= 20; $i++) {
//code for $i 11-20
}
for ($i=21; $i <= 30; $i++) {
//code for $i 21-30
}
2. Put the conditionals inside one for loop, but use <= instead of ==
for ($i=1; $i <= 30; $i++) {
if($i <= 10){
//code for $i 1-10
}
else if($i <= 20){
// code for $i 11-20
}
else{
// code for $i 21-30
}
}
Alternatively, you could use $i > 0 && $i <= 10
for the if
conditions if you prefer or for readability, but the above code does exactly the same with less.
Personally, for your specific example, I would prefer using the first option, as it is much more readable (for me).