What are the best practices for structuring nested while loops in PHP?

When structuring nested while loops in PHP, it is important to maintain clarity and readability in your code. One best practice is to use meaningful variable names to keep track of loop conditions and iterations. Additionally, consider breaking down complex nested loops into separate functions or using conditional statements to simplify the logic. Lastly, be mindful of the performance implications of nested loops and optimize your code as needed.

// Example of structuring nested while loops in PHP
$outerLoop = 0;

while ($outerLoop < 5) {
    $innerLoop = 0;
    
    while ($innerLoop < 3) {
        echo "Outer loop: $outerLoop, Inner loop: $innerLoop \n";
        $innerLoop++;
    }
    
    $outerLoop++;
}