What are the potential pitfalls of using nested loops in PHP, as seen in the provided code snippet?

Using nested loops in PHP can lead to performance issues, especially if the loops iterate over a large dataset. This can result in increased execution time and potentially slow down the script. To solve this issue, consider if nested loops are truly necessary and if there are alternative methods to achieve the desired outcome with better efficiency. If nested loops are unavoidable, try to optimize the loops by minimizing unnecessary iterations or using break statements when possible.

// Example of optimizing nested loops
$numbers = [1, 2, 3, 4, 5];
$letters = ['a', 'b', 'c', 'd', 'e'];

foreach ($numbers as $number) {
    foreach ($letters as $letter) {
        echo $number . $letter . " ";
    }
}