What are the potential drawbacks of using nested for loops with the same loop variable in PHP code?

Using nested for loops with the same loop variable in PHP can lead to unexpected behavior and errors. This is because the inner loop will overwrite the value of the loop variable in the outer loop, causing incorrect iterations and results. To solve this issue, you can use different loop variables for each nested loop to ensure that they do not interfere with each other.

for ($i = 0; $i < 5; $i++) {
    for ($j = 0; $j < 3; $j++) {
        echo "Outer loop: $i, Inner loop: $j\n";
    }
}