i found this piece of code that generates words through a given string on stackoverflow, and it works, in my opinion, perfectly, there is only a problem... It uses arrays and as we all know arrays have a maximum dimension, so I ask you if there is a way to change this code in order not to use arrays but only "echo" or maybe an external .txt file or whatever you want that hasn't a memory limit

```
$letters = str_split("abc");

$combos = $letters;
$lastres = $letters;
for ($i = 1; $i < count($letters); $i++) {
    $newres = array();
    foreach ($lastres as $r) {
        foreach ($letters as $let) {
            $newres[] = $r . $let;

        }
    }

    foreach ($newres as $w) {
        $combos[] = $w;
    }

    $lastres = $newres;
}
foreach($combos as $comb){
    echo $comb."<br>";
}

```

I tried to think to a solution but can't get it :/   

If you need, you can change the code how you want to, there are no problems.