What potential pitfalls should be avoided when using for loops in PHP to call functions repeatedly?

One potential pitfall to avoid when using for loops in PHP to call functions repeatedly is not properly incrementing the loop counter. If the counter is not incremented correctly, it can lead to an infinite loop or skipping over certain iterations. To solve this, make sure to increment the loop counter within the loop.

// Incorrect way to use a for loop to call a function repeatedly
for ($i = 0; $i < 5; $i) {
    myFunction();
}

// Correct way to use a for loop to call a function repeatedly
for ($i = 0; $i < 5; $i++) {
    myFunction();
}