What are the potential pitfalls of using a for loop in PHP for generating a sequence of numbers?

One potential pitfall of using a for loop in PHP for generating a sequence of numbers is that it can be easy to introduce off-by-one errors if the loop conditions are not carefully set. To avoid this issue, it's important to ensure that the loop starts at the correct initial value and ends at the correct final value.

// Generating a sequence of numbers from 1 to 10 without off-by-one errors
for ($i = 1; $i <= 10; $i++) {
    echo $i . " ";
}