fai dei cicli for annidati. Usando le lettere invece dei numeri.
codice:
$first = 'a';
$last = 'e';
$tot = array();
for( $a = $first; $a <= $last; $a++) {
$tot[] = $a;
    for( $b = $first; $b <= $last; $b++) {
    $tot[] = $a.$b;
         for( $c = $first; $c <= $last; $c++) {
         $tot[] = $a.$b.$c;
                for( $d = $first; $d <= $last; $d++) {
                $tot[] = $a.$b.$c.$d;
                      for( $e = $first; $e <= $last; $e++) {
                      $tot[] = $a.$b.$c.$d.$e;
                      }
                }
         }
    }
}
echo "<pre>";
print_r($tot);